SQLite
Check-in [e890bcde34]
Not logged in
Overview
SHA1 Hash:e890bcde34370079f4da011da39e4ba8224ffab4
Date: 2012-12-07 04:46:53
User: mistachkin
Comment:Backport VSIX tooling and packaging fixes and enhancements.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to Makefile.msc

825 $(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl < tsrc\vdbe.c > vdbe.new 825 $(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl < tsrc\vdbe.c > vdbe.new 826 move vdbe.new tsrc\vdbe.c 826 move vdbe.new tsrc\vdbe.c 827 echo > .target_source 827 echo > .target_source 828 828 829 sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl 829 sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl 830 $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl 830 $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl 831 831 832 sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl | 832 sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl 833 $(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl | 833 $(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl 834 834 835 # Rule to build the amalgamation 835 # Rule to build the amalgamation 836 # 836 # 837 sqlite3.lo: sqlite3.c 837 sqlite3.lo: sqlite3.c 838 $(LTCOMPILE) -c sqlite3.c 838 $(LTCOMPILE) -c sqlite3.c 839 839 840 # Rules to build the LEMON compiler generator 840 # Rules to build the LEMON compiler generator ................................................................................................................................................................................ 1243 del /Q .target_source 1243 del /Q .target_source 1244 del /Q tclsqlite3.exe tclsqlite3.exp 1244 del /Q tclsqlite3.exe tclsqlite3.exp 1245 del /Q testfixture.exe testfixture.exp test.db 1245 del /Q testfixture.exe testfixture.exp test.db 1246 del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def 1246 del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def 1247 del /Q sqlite3.c 1247 del /Q sqlite3.c 1248 del /Q sqlite3rc.h 1248 del /Q sqlite3rc.h 1249 del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c 1249 del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c 1250 del /Q sqlite-output.vsix | 1250 del /Q sqlite-*-output.vsix 1251 1251 1252 # Dynamic link library section. 1252 # Dynamic link library section. 1253 # 1253 # 1254 dll: sqlite3.dll 1254 dll: sqlite3.dll 1255 1255 1256 sqlite3.def: libsqlite3.lib 1256 sqlite3.def: libsqlite3.lib 1257 echo EXPORTS > sqlite3.def 1257 echo EXPORTS > sqlite3.def 1258 dumpbin /all libsqlite3.lib \ 1258 dumpbin /all libsqlite3.lib \ 1259 | $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \ 1259 | $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \ 1260 | sort >> sqlite3.def 1260 | sort >> sqlite3.def 1261 1261 1262 sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def 1262 sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def 1263 $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT: 1263 $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:

Changes to tool/build-all-msvc.bat

2 2 3 :: 3 :: 4 :: build-all-msvc.bat -- 4 :: build-all-msvc.bat -- 5 :: 5 :: 6 :: Multi-Platform Build Tool for MSVC 6 :: Multi-Platform Build Tool for MSVC 7 :: 7 :: 8 8 > 9 REM > 10 REM This batch script is used to build the SQLite DLL for multiple platforms > 11 REM and configurations using MSVC. The built SQLite DLLs, their associated > 12 REM import libraries, and optionally their symbols files, are placed within > 13 REM the directory specified on the command line, in sub-directories named for > 14 REM their respective platforms and configurations. This batch script must be > 15 REM run from inside a Visual Studio Command Prompt for the desired version of > 16 REM Visual Studio ^(the initial platform configured for the command prompt does > 17 REM not really matter^). Exactly one command line argument is required, the > 18 REM name of an existing directory to be used as the final destination directory > 19 REM for the generated output files, which will be placed in sub-directories > 20 REM created therein. Ideally, the directory specified should be empty. > 21 REM > 22 REM Example: > 23 REM > 24 REM CD /D C:\dev\sqlite\core > 25 REM tool\build-all-msvc.bat C:\Temp > 26 REM > 27 REM In the example above, "C:\dev\sqlite\core" represents the root of the > 28 REM source tree for SQLite and "C:\Temp" represents the final destination > 29 REM directory for the generated output files. > 30 REM > 31 REM There are several environment variables that may be set to modify the > 32 REM behavior of this batch script and its associated Makefile. The list of > 33 REM platforms to build may be overriden by using the PLATFORMS environment > 34 REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64 > 35 REM x86_arm^). All platforms must be supported by the version of Visual Studio > 36 REM being used. The list of configurations to build may be overridden by > 37 REM setting the CONFIGURATIONS environment variable, which should contain a > 38 REM list of configurations to build ^(e.g. Debug Retail^). Neither of these > 39 REM variable values may contain any double quotes, surrounding or embedded. > 40 REM Finally, the NCRTLIBPATH and NSDKLIBPATH environment variables may be set > 41 REM to specify the location of the CRT and SDK, respectively, needed to compile > 42 REM executables native to the architecture of the build machine during any > 43 REM cross-compilation that may be necessary, depending on the platforms to be > 44 REM built. These values in these two variables should be surrounded by double > 45 REM quotes if they contain spaces. > 46 REM > 47 REM Please note that the SQLite build process performed by the Makefile > 48 REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl > 49 REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH > 50 REM environment variable unless a pre-existing amalgamation file is used. > 51 REM 9 SETLOCAL 52 SETLOCAL 10 53 11 REM SET __ECHO=ECHO 54 REM SET __ECHO=ECHO 12 REM SET __ECHO2=ECHO 55 REM SET __ECHO2=ECHO 13 REM SET __ECHO3=ECHO 56 REM SET __ECHO3=ECHO 14 IF NOT DEFINED _AECHO (SET _AECHO=REM) 57 IF NOT DEFINED _AECHO (SET _AECHO=REM) 15 IF NOT DEFINED _CECHO (SET _CECHO=REM) 58 IF NOT DEFINED _CECHO (SET _CECHO=REM) ................................................................................................................................................................................ 89 REM 132 REM 90 IF NOT DEFINED PLATFORMS ( 133 IF NOT DEFINED PLATFORMS ( 91 SET PLATFORMS=x86 x86_amd64 x86_arm 134 SET PLATFORMS=x86 x86_amd64 x86_arm 92 ) 135 ) 93 136 94 %_VECHO% Platforms = '%PLATFORMS%' 137 %_VECHO% Platforms = '%PLATFORMS%' 95 138 > 139 REM > 140 REM NOTE: If the list of configurations is not already set, use the default > 141 REM list. > 142 REM > 143 IF NOT DEFINED CONFIGURATIONS ( > 144 SET CONFIGURATIONS=Debug Retail > 145 ) > 146 > 147 %_VECHO% Configurations = '%CONFIGURATIONS%' > 148 96 REM 149 REM 97 REM NOTE: Setup environment variables to translate between the MSVC platform 150 REM NOTE: Setup environment variables to translate between the MSVC platform 98 REM names and the names to be used for the platform-specific binary 151 REM names and the names to be used for the platform-specific binary 99 REM directories. 152 REM directories. 100 REM 153 REM > 154 SET amd64_NAME=x64 > 155 SET arm_NAME=ARM > 156 SET x64_NAME=x64 101 SET x86_NAME=x86 157 SET x86_NAME=x86 102 SET x86_amd64_NAME=x64 158 SET x86_amd64_NAME=x64 103 SET x86_arm_NAME=ARM 159 SET x86_arm_NAME=ARM > 160 SET x86_x64_NAME=x64 104 161 > 162 %_VECHO% amd64_Name = '%amd64_NAME%' > 163 %_VECHO% arm_Name = '%arm_NAME%' > 164 %_VECHO% x64_Name = '%x64_NAME%' 105 %_VECHO% x86_Name = '%x86_NAME%' 165 %_VECHO% x86_Name = '%x86_NAME%' 106 %_VECHO% x86_amd64_Name = '%x86_amd64_NAME%' 166 %_VECHO% x86_amd64_Name = '%x86_amd64_NAME%' 107 %_VECHO% x86_arm_Name = '%x86_arm_NAME%' 167 %_VECHO% x86_arm_Name = '%x86_arm_NAME%' > 168 %_VECHO% x86_x64_Name = '%x86_x64_NAME%' 108 169 109 REM 170 REM 110 REM NOTE: Check for the external tools needed during the build process ^(i.e. 171 REM NOTE: Check for the external tools needed during the build process ^(i.e. 111 REM those that do not get compiled as part of the build process itself^) 172 REM those that do not get compiled as part of the build process itself^) 112 REM along the PATH. 173 REM along the PATH. 113 REM 174 REM 114 FOR %%T IN (gawk.exe tclsh85.exe) DO ( 175 FOR %%T IN (gawk.exe tclsh85.exe) DO ( 115 SET %%T_PATH=%%~dp$PATH:T 176 SET %%T_PATH=%%~dp$PATH:T 116 ) 177 ) > 178 > 179 REM > 180 REM NOTE: The Gawk executable "gawk.exe" is required during the SQLite build > 181 REM process unless a pre-existing amalgamation file is used. > 182 REM > 183 IF NOT DEFINED gawk.exe_PATH ( > 184 ECHO The Gawk executable "gawk.exe" is required to be in the PATH. > 185 GOTO errors > 186 ) > 187 > 188 REM > 189 REM NOTE: The Tcl 8.5 executable "tclsh85.exe" is required during the SQLite > 190 REM build process unless a pre-existing amalgamation file is used. > 191 REM > 192 IF NOT DEFINED tclsh85.exe_PATH ( > 193 ECHO The Tcl 8.5 executable "tclsh85.exe" is required to be in the PATH. > 194 GOTO errors > 195 ) 117 196 118 REM 197 REM 119 REM NOTE: Set the TOOLPATH variable to contain all the directories where the 198 REM NOTE: Set the TOOLPATH variable to contain all the directories where the 120 REM external tools were found in the search above. 199 REM external tools were found in the search above. 121 REM 200 REM 122 SET TOOLPATH=%gawk.exe_PATH%;%tclsh85.exe_PATH% 201 SET TOOLPATH=%gawk.exe_PATH%;%tclsh85.exe_PATH% 123 202 ................................................................................................................................................................................ 124 %_VECHO% ToolPath = '%TOOLPATH%' 203 %_VECHO% ToolPath = '%TOOLPATH%' 125 204 126 REM 205 REM 127 REM NOTE: Check for MSVC 2012 because the Windows SDK directory handling is 206 REM NOTE: Check for MSVC 2012 because the Windows SDK directory handling is 128 REM slightly different for that version. 207 REM slightly different for that version. 129 REM 208 REM 130 IF "%VisualStudioVersion%" == "11.0" ( 209 IF "%VisualStudioVersion%" == "11.0" ( > 210 REM > 211 REM NOTE: If the Windows SDK library path has already been set, do not set > 212 REM it to something else later on. > 213 REM > 214 IF NOT DEFINED NSDKLIBPATH ( 131 SET SET_NSDKLIBPATH=1 | 215 SET SET_NSDKLIBPATH=1 > 216 ) 132 ) ELSE ( 217 ) ELSE ( 133 CALL :fn_UnsetVariable SET_NSDKLIBPATH 218 CALL :fn_UnsetVariable SET_NSDKLIBPATH 134 ) 219 ) 135 220 > 221 REM > 222 REM NOTE: Check if this is the Windows Phone SDK. If so, a different batch > 223 REM file is necessary to setup the build environment. Since the variable > 224 REM values involved here may contain parenthesis, using GOTO instead of > 225 REM an IF block is required. > 226 REM > 227 IF DEFINED WindowsPhoneKitDir GOTO set_vcvarsall_phone > 228 SET VCVARSALL=%VCINSTALLDIR%\vcvarsall.bat > 229 GOTO set_vcvarsall_done > 230 :set_vcvarsall_phone > 231 SET VCVARSALL=%VCINSTALLDIR%\WPSDK\WP80\vcvarsphoneall.bat > 232 :set_vcvarsall_done > 233 136 REM 234 REM 137 REM NOTE: This is the outer loop. There should be exactly one iteration per 235 REM NOTE: This is the outer loop. There should be exactly one iteration per 138 REM platform. 236 REM platform. 139 REM 237 REM 140 FOR %%P IN (%PLATFORMS%) DO ( 238 FOR %%P IN (%PLATFORMS%) DO ( 141 REM 239 REM 142 REM NOTE: Using the MSVC platform name, lookup the simpler platform name to 240 REM NOTE: Using the MSVC platform name, lookup the simpler platform name to ................................................................................................................................................................................ 169 CALL :fn_UnsetVariable FSHARPINSTALLDIR 267 CALL :fn_UnsetVariable FSHARPINSTALLDIR 170 CALL :fn_UnsetVariable INCLUDE 268 CALL :fn_UnsetVariable INCLUDE 171 CALL :fn_UnsetVariable LIB 269 CALL :fn_UnsetVariable LIB 172 CALL :fn_UnsetVariable LIBPATH 270 CALL :fn_UnsetVariable LIBPATH 173 CALL :fn_UnsetVariable Platform 271 CALL :fn_UnsetVariable Platform 174 REM CALL :fn_UnsetVariable VCINSTALLDIR 272 REM CALL :fn_UnsetVariable VCINSTALLDIR 175 CALL :fn_UnsetVariable VSINSTALLDIR 273 CALL :fn_UnsetVariable VSINSTALLDIR > 274 CALL :fn_UnsetVariable WindowsPhoneKitDir 176 CALL :fn_UnsetVariable WindowsSdkDir 275 CALL :fn_UnsetVariable WindowsSdkDir 177 CALL :fn_UnsetVariable WindowsSdkDir_35 276 CALL :fn_UnsetVariable WindowsSdkDir_35 178 CALL :fn_UnsetVariable WindowsSdkDir_old 277 CALL :fn_UnsetVariable WindowsSdkDir_old 179 278 180 REM 279 REM 181 REM NOTE: Reset the PATH here to the absolute bare minimum required. 280 REM NOTE: Reset the PATH here to the absolute bare minimum required. 182 REM 281 REM 183 SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot% 282 SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot% 184 283 185 FOR %%B IN (Debug Retail) DO ( | 284 FOR %%B IN (%CONFIGURATIONS%) DO ( 186 REM 285 REM 187 REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG 286 REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG 188 REM environment variables to be picked up by the MSVC makefile 287 REM environment variables to be picked up by the MSVC makefile 189 REM itself. 288 REM itself. 190 REM 289 REM 191 IF /I "%%B" == "Debug" ( 290 IF /I "%%B" == "Debug" ( 192 SET DEBUG=2 291 SET DEBUG=2 ................................................................................................................................................................................ 211 REM platform to the platform-specific directory beneath the 310 REM platform to the platform-specific directory beneath the 212 REM binary directory. 311 REM binary directory. 213 REM 312 REM 214 "%ComSpec%" /C ( 313 "%ComSpec%" /C ( 215 REM 314 REM 216 REM NOTE: Attempt to setup the MSVC environment for this platform. 315 REM NOTE: Attempt to setup the MSVC environment for this platform. 217 REM 316 REM 218 %__ECHO3% CALL "%VCINSTALLDIR%\vcvarsall.bat" %%P | 317 %__ECHO3% CALL "%VCVARSALL%" %%P 219 318 220 IF ERRORLEVEL 1 ( 319 IF ERRORLEVEL 1 ( 221 ECHO Failed to call "%VCINSTALLDIR%\vcvarsall.bat" for platform %%P. | 320 ECHO Failed to call "%VCVARSALL%" for platform %%P. 222 GOTO errors 321 GOTO errors 223 ) 322 ) 224 323 225 REM 324 REM 226 REM NOTE: If this batch file is not running in "what-if" mode, check to 325 REM NOTE: If this batch file is not running in "what-if" mode, check to 227 REM be sure we were actually able to setup the MSVC environment 326 REM be sure we were actually able to setup the MSVC environment 228 REM as current versions of their official batch file do not set 327 REM as current versions of their official batch file do not set 229 REM the exit code upon failure. 328 REM the exit code upon failure. 230 REM 329 REM 231 IF NOT DEFINED __ECHO ( | 330 IF NOT DEFINED __ECHO3 ( > 331 IF NOT DEFINED WindowsPhoneKitDir ( 232 IF NOT DEFINED WindowsSdkDir ( | 332 IF NOT DEFINED WindowsSdkDir ( 233 ECHO Cannot build, Windows SDK not found for platform %%P. | 333 ECHO Cannot build, Windows SDK not found for platform %%P. 234 GOTO errors | 334 GOTO errors > 335 ) 235 ) 336 ) 236 ) 337 ) 237 338 238 REM 339 REM 239 REM NOTE: When using MSVC 2012, the native SDK path cannot simply use 340 REM NOTE: When using MSVC 2012, the native SDK path cannot simply use 240 REM the "lib" sub-directory beneath the location specified in the 341 REM the "lib" sub-directory beneath the location specified in the 241 REM WindowsSdkDir environment variable because that location does 342 REM WindowsSdkDir environment variable because that location does 242 REM not actually contain the necessary library files for x86. 343 REM not actually contain the necessary library files for x86. 243 REM This must be done for each iteration because it relies upon 344 REM This must be done for each iteration because it relies upon 244 REM the WindowsSdkDir environment variable being set by the batch 345 REM the WindowsSdkDir environment variable being set by the batch 245 REM file used to setup the MSVC environment. 346 REM file used to setup the MSVC environment. 246 REM 347 REM 247 IF DEFINED SET_NSDKLIBPATH ( 348 IF DEFINED SET_NSDKLIBPATH ( > 349 IF DEFINED WindowsPhoneKitDir ( > 350 CALL :fn_CopyVariable WindowsPhoneKitDir NSDKLIBPATH > 351 CALL :fn_AppendVariable NSDKLIBPATH \lib\x86 > 352 ) ELSE IF DEFINED WindowsSdkDir ( 248 CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH | 353 CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH 249 CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86 | 354 CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86 > 355 ) 250 ) 356 ) 251 357 252 REM 358 REM 253 REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC 359 REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC 254 REM makefile to clean any stale build output from previous 360 REM makefile to clean any stale build output from previous 255 REM iterations of this loop and/or previous runs of this batch 361 REM iterations of this loop and/or previous runs of this batch 256 REM file, etc. 362 REM file, etc.

Changes to tool/mkvsix.tcl

1 #!/usr/bin/tclsh 1 #!/usr/bin/tclsh 2 # 2 # 3 # This script is used to generate a VSIX (Visual Studio Extension) file for 3 # This script is used to generate a VSIX (Visual Studio Extension) file for 4 # SQLite usable by Visual Studio. 4 # SQLite usable by Visual Studio. 5 | 5 # > 6 # PREREQUISITES > 7 # > 8 # 1. Tcl 8.4 and later are supported, earlier versions have not been tested. > 9 # > 10 # 2. The "sqlite3.h" file is assumed to exist in the parent directory of the > 11 # directory containing this script. The [optional] second command line > 12 # argument to this script may be used to specify an alternate location. > 13 # This script also assumes that the "sqlite3.h" file corresponds with the > 14 # version of the binaries to be packaged. This assumption is not verified > 15 # by this script. > 16 # > 17 # 3. The temporary directory specified in the TEMP or TMP environment variables > 18 # must refer to an existing directory writable by the current user. > 19 # > 20 # 4. The "zip" and "unzip" command line tools must be located either in a > 21 # directory contained in the PATH environment variable or specified as the > 22 # exact file names to execute in the "ZipTool" and "UnZipTool" environment > 23 # variables, respectively. > 24 # > 25 # 5. The template VSIX file (which is basically a zip file) must be located in > 26 # a "win" directory inside the directory containing this script. It should > 27 # not contain any executable binaries. It should only contain dynamic > 28 # textual content files to be processed using [subst] and/or static content > 29 # files to be copied verbatim. > 30 # > 31 # 6. The executable and other compiled binary files to be packaged into the > 32 # final VSIX file (e.g. DLLs, LIBs, and PDBs) must be located in a single > 33 # directory tree. The top-level directory of the tree must be specified as > 34 # the first command line argument to this script. The second level > 35 # sub-directory names must match those of the build configuration (e.g. > 36 # "Debug" or "Retail"). The third level sub-directory names must match > 37 # those of the platform (e.g. "x86", "x64", and "ARM"). For example, the > 38 # binary files to be packaged would need to be organized as follows when > 39 # packaging the "Debug" and "Retail" build configurations for the "x86" and > 40 # "x64" platforms (in this example, "C:\temp" is the top-level directory as > 41 # specified in the first command line argument): > 42 # > 43 # C:\Temp\Debug\x86\sqlite3.lib > 44 # C:\Temp\Debug\x86\sqlite3.dll > 45 # C:\Temp\Debug\x86\sqlite3.pdb > 46 # C:\Temp\Debug\x64\sqlite3.lib > 47 # C:\Temp\Debug\x64\sqlite3.dll > 48 # C:\Temp\Debug\x64\sqlite3.pdb > 49 # C:\Temp\Retail\x86\sqlite3.lib > 50 # C:\Temp\Retail\x86\sqlite3.dll > 51 # C:\Temp\Retail\x86\sqlite3.pdb > 52 # C:\Temp\Retail\x64\sqlite3.lib > 53 # C:\Temp\Retail\x64\sqlite3.dll > 54 # C:\Temp\Retail\x64\sqlite3.pdb > 55 # > 56 # The above directory tree organization is performed automatically if the > 57 # "tool\build-all-msvc.bat" batch script is used to build the binary files > 58 # to be packaged. > 59 # > 60 # USAGE > 61 # > 62 # The first argument to this script is required and must be the name of the > 63 # top-level directory containing the directories and files organized into a > 64 # tree as described in item 6 of the PREREQUISITES section, above. The second > 65 # argument is optional and if present must contain the name of the directory > 66 # containing the root of the source tree for SQLite. The third argument is > 67 # optional and if present must contain the flavor the VSIX package to build. > 68 # Currently, the only supported package flavors are "WinRT" and "WP80". The > 69 # fourth argument is optional and if present must be a string containing a list > 70 # of platforms to include in the VSIX package. The format of the platform list > 71 # string is "platform1,platform2,platform3". Typically, when on Windows, this > 72 # script is executed using commands similar to the following from a normal > 73 # Windows command prompt: > 74 # > 75 # CD /D C:\dev\sqlite\core > 76 # tclsh85 tool\mkvsix.tcl C:\Temp > 77 # > 78 # In the example above, "C:\dev\sqlite\core" represents the root of the source > 79 # tree for SQLite and "C:\Temp" represents the top-level directory containing > 80 # the executable and other compiled binary files, organized into a directory > 81 # tree as described in item 6 of the PREREQUISITES section, above. > 82 # > 83 # This script should work on non-Windows platforms as well, provided that all > 84 # the requirements listed in the PREREQUISITES section are met. > 85 # > 86 # NOTES > 87 # > 88 # The temporary directory is used as a staging area for the final VSIX file. > 89 # The template VSIX file is extracted, its contents processed, and then the > 90 # resulting files are packaged into the final VSIX file. > 91 # > 92 package require Tcl 8.4 > 93 6 proc fail { {error ""} {usage false} } { 94 proc fail { {error ""} {usage false} } { 7 if {[string length $error] > 0} then { 95 if {[string length $error] > 0} then { 8 puts stdout $error 96 puts stdout $error 9 if {!$usage} then {exit 1} 97 if {!$usage} then {exit 1} 10 } 98 } 11 99 12 puts stdout "usage:\ 100 puts stdout "usage:\ 13 [file tail [info nameofexecutable]]\ 101 [file tail [info nameofexecutable]]\ 14 [file tail [info script]] <binaryDirectory> \[sourceDirectory\]" | 102 [file tail [info script]] <binaryDirectory> \[sourceDirectory\]\ > 103 \[packageFlavor\] \[platformNames\]" 15 104 16 exit 1 105 exit 1 17 } 106 } 18 107 19 proc getEnvironmentVariable { name } { 108 proc getEnvironmentVariable { name } { 20 # 109 # 21 # NOTE: Returns the value of the specified environment variable or an empty 110 # NOTE: Returns the value of the specified environment variable or an empty ................................................................................................................................................................................ 80 close $file_id 169 close $file_id 81 return "" 170 return "" 82 } 171 } 83 172 84 proc substFile { fileName } { 173 proc substFile { fileName } { 85 # 174 # 86 # NOTE: Performs all Tcl command, variable, and backslash substitutions in 175 # NOTE: Performs all Tcl command, variable, and backslash substitutions in 87 # the specified file and then re-writes the contents of that same file | 176 # the specified file and then rewrites the contents of that same file 88 # with the substituted data. 177 # with the substituted data. 89 # 178 # 90 return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]] 179 return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]] 91 } 180 } 92 181 93 proc replaceBuildAndPlatform { fileName buildName platformName } { | 182 proc replaceFileNameTokens { fileName name buildName platformName } { 94 # 183 # 95 # NOTE: Returns the specified file name containing the platform name instead 184 # NOTE: Returns the specified file name containing the platform name instead 96 # of platform placeholder tokens. 185 # of platform placeholder tokens. 97 # 186 # 98 return [string map [list <build> $buildName <platform> $platformName] \ | 187 return [string map [list <build> $buildName <platform> $platformName \ 99 $fileName] | 188 <name> $name] $fileName] 100 } 189 } 101 190 > 191 # > 192 # NOTE: This is the entry point for this script. > 193 # 102 set script [file normalize [info script]] 194 set script [file normalize [info script]] 103 195 104 if {[string length $script] == 0} then { 196 if {[string length $script] == 0} then { 105 fail "script file currently being evaluated is unknown" true 197 fail "script file currently being evaluated is unknown" true 106 } 198 } 107 199 108 set path [file dirname $script] 200 set path [file dirname $script] ................................................................................................................................................................................ 110 202 111 ############################################################################### 203 ############################################################################### 112 204 113 # 205 # 114 # NOTE: Process and verify all the command line arguments. 206 # NOTE: Process and verify all the command line arguments. 115 # 207 # 116 set argc [llength $argv] 208 set argc [llength $argv] 117 if {$argc != 1 && $argc != 2} then {fail} | 209 if {$argc < 1 || $argc > 4} then {fail} 118 210 119 set binaryDirectory [lindex $argv 0] 211 set binaryDirectory [lindex $argv 0] 120 212 121 if {[string length $binaryDirectory] == 0} then { 213 if {[string length $binaryDirectory] == 0} then { 122 fail "invalid binary directory" 214 fail "invalid binary directory" 123 } 215 } 124 216 125 if {![file exists $binaryDirectory] || \ 217 if {![file exists $binaryDirectory] || \ 126 ![file isdirectory $binaryDirectory]} then { 218 ![file isdirectory $binaryDirectory]} then { 127 fail "binary directory does not exist" 219 fail "binary directory does not exist" 128 } 220 } 129 221 130 if {$argc == 2} then { | 222 if {$argc >= 2} then { 131 set sourceDirectory [lindex $argv 1] 223 set sourceDirectory [lindex $argv 1] 132 } else { 224 } else { 133 # 225 # 134 # NOTE: Assume that the source directory is the parent directory of the one 226 # NOTE: Assume that the source directory is the parent directory of the one 135 # that contains this script file. 227 # that contains this script file. 136 # 228 # 137 set sourceDirectory [file dirname $path] 229 set sourceDirectory [file dirname $path] ................................................................................................................................................................................ 141 fail "invalid source directory" 233 fail "invalid source directory" 142 } 234 } 143 235 144 if {![file exists $sourceDirectory] || \ 236 if {![file exists $sourceDirectory] || \ 145 ![file isdirectory $sourceDirectory]} then { 237 ![file isdirectory $sourceDirectory]} then { 146 fail "source directory does not exist" 238 fail "source directory does not exist" 147 } 239 } > 240 > 241 if {$argc >= 3} then { > 242 set packageFlavor [lindex $argv 2] > 243 } else { > 244 # > 245 # NOTE: Assume the package flavor is WinRT. > 246 # > 247 set packageFlavor WinRT > 248 } > 249 > 250 if {[string length $packageFlavor] == 0} then { > 251 fail "invalid package flavor" > 252 } > 253 > 254 if {[string equal -nocase $packageFlavor WinRT]} then { > 255 set shortName SQLite.WinRT > 256 set displayName "SQLite for Windows Runtime" > 257 set targetPlatformIdentifier Windows > 258 set extraSdkPath "" > 259 set extraFileListAttributes [appendArgs \ > 260 "\r\n " {AppliesTo="WindowsAppContainer"} \ > 261 "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}] > 262 } elseif {[string equal -nocase $packageFlavor WP80]} then { > 263 set shortName SQLite.WP80 > 264 set displayName "SQLite for Windows Phone" > 265 set targetPlatformIdentifier "Windows Phone" > 266 set extraSdkPath "\\..\\$targetPlatformIdentifier" > 267 set extraFileListAttributes "" > 268 } else { > 269 fail "unsupported package flavor, must be \"WinRT\" or \"WP80\"" > 270 } > 271 > 272 if {$argc >= 4} then { > 273 set platformNames [list] > 274 > 275 foreach platformName [split [lindex $argv 3] ", "] { > 276 if {[string length $platformName] > 0} then { > 277 lappend platformNames $platformName > 278 } > 279 } > 280 } 148 281 149 ############################################################################### 282 ############################################################################### 150 283 151 # 284 # 152 # NOTE: Evaluate the user-specific customizations file, if it exists. 285 # NOTE: Evaluate the user-specific customizations file, if it exists. 153 # 286 # 154 set userFile [file join $path [appendArgs \ 287 set userFile [file join $path [appendArgs \ ................................................................................................................................................................................ 165 298 166 if {![file exists $templateFile] || \ 299 if {![file exists $templateFile] || \ 167 ![file isfile $templateFile]} then { 300 ![file isfile $templateFile]} then { 168 fail [appendArgs "template file \"" $templateFile "\" does not exist"] 301 fail [appendArgs "template file \"" $templateFile "\" does not exist"] 169 } 302 } 170 303 171 set currentDirectory [pwd] 304 set currentDirectory [pwd] 172 set outputFile [file join $currentDirectory sqlite-output.vsix] | 305 set outputFile [file join $currentDirectory [appendArgs sqlite- \ > 306 $packageFlavor -output.vsix]] 173 307 174 if {[file exists $outputFile]} then { 308 if {[file exists $outputFile]} then { 175 fail [appendArgs "output file \"" $outputFile "\" already exists"] 309 fail [appendArgs "output file \"" $outputFile "\" already exists"] 176 } 310 } 177 311 178 ############################################################################### 312 ############################################################################### 179 313 ................................................................................................................................................................................ 241 fail [appendArgs "cannot locate SQLITE_VERSION value in \"" \ 375 fail [appendArgs "cannot locate SQLITE_VERSION value in \"" \ 242 [file join $sourceDirectory sqlite3.h] \"] 376 [file join $sourceDirectory sqlite3.h] \"] 243 } 377 } 244 378 245 ############################################################################### 379 ############################################################################### 246 380 247 # 381 # 248 # NOTE: Setup the master file list data, including the necessary flags. | 382 # NOTE: Setup all the master file list data. This includes the source file > 383 # names, the destination file names, and the file processing flags. The > 384 # possible file processing flags are: 249 # 385 # > 386 # "buildNeutral" -- This flag indicates the file location and content do > 387 # not depend on the build configuration. > 388 # > 389 # "platformNeutral" -- This flag indicates the file location and content > 390 # do not depend on the build platform. > 391 # > 392 # "subst" -- This flag indicates that the file contains dynamic textual > 393 # content that needs to be processed using [subst] prior to > 394 # packaging the file into the final VSIX package. The primary > 395 # use of this flag is to insert the name of the VSIX package, > 396 # some package flavor-specific value, or the SQLite version > 397 # into a file. > 398 # > 399 # "noDebug" -- This flag indicates that the file should be skipped when > 400 # processing the debug build. > 401 # > 402 # "noRetail" -- This flag indicates that the file should be skipped when > 403 # processing the retail build. > 404 # > 405 # "move" -- This flag indicates that the file should be moved from the > 406 # source to the destination instead of being copied. > 407 # > 408 # This file metadata may be overridden, either in whole or in part, via > 409 # the user-specific customizations file. > 410 # 250 if {![info exists fileNames(source)]} then { 411 if {![info exists fileNames(source)]} then { 251 set fileNames(source) [list "" "" "" \ | 412 set fileNames(source) [list "" "" \ > 413 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.props] \ 252 [file join $sourceDirectory sqlite3.h] \ | 414 [file join $sourceDirectory sqlite3.h] \ 253 [file join $binaryDirectory <build> <platform> sqlite3.lib] \ | 415 [file join $binaryDirectory <build> <platform> sqlite3.lib] \ 254 [file join $binaryDirectory <build> <platform> sqlite3.dll]] | 416 [file join $binaryDirectory <build> <platform> sqlite3.dll]] 255 417 256 if {![info exists no(symbols)]} then { 418 if {![info exists no(symbols)]} then { 257 lappend fileNames(source) \ 419 lappend fileNames(source) \ 258 [file join $binaryDirectory <build> <platform> sqlite3.pdb] 420 [file join $binaryDirectory <build> <platform> sqlite3.pdb] 259 } 421 } 260 } 422 } 261 423 262 if {![info exists fileNames(destination)]} then { 424 if {![info exists fileNames(destination)]} then { 263 set fileNames(destination) [list \ 425 set fileNames(destination) [list \ 264 [file join $stagingDirectory extension.vsixmanifest] \ | 426 [file join $stagingDirectory extension.vsixmanifest] \ 265 [file join $stagingDirectory SDKManifest.xml] \ | 427 [file join $stagingDirectory SDKManifest.xml] \ 266 [file join $stagingDirectory DesignTime <build> <platform> \ | 428 [file join $stagingDirectory DesignTime <build> <platform> <name>.props] \ 267 SQLite.WinRT.props] \ < 268 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.h] \ | 429 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.h] \ 269 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.lib] \ | 430 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.lib] \ 270 [file join $stagingDirectory Redist <build> <platform> sqlite3.dll]] | 431 [file join $stagingDirectory Redist <build> <platform> sqlite3.dll]] 271 432 272 if {![info exists no(symbols)]} then { 433 if {![info exists no(symbols)]} then { 273 lappend fileNames(destination) \ 434 lappend fileNames(destination) \ 274 [file join $stagingDirectory Redist <build> <platform> sqlite3.pdb] 435 [file join $stagingDirectory Redist <build> <platform> sqlite3.pdb] 275 } 436 } 276 } 437 } 277 438 278 if {![info exists fileNames(buildNeutral)]} then { | 439 if {![info exists fileNames(flags)]} then { 279 set fileNames(buildNeutral) [list 1 1 1 1 0 0] | 440 set fileNames(flags) [list \ 280 < > 441 [list buildNeutral platformNeutral subst] \ 281 if {![info exists no(symbols)]} then { | 442 [list buildNeutral platformNeutral subst] \ 282 lappend fileNames(buildNeutral) 0 | 443 [list buildNeutral platformNeutral subst move] \ 283 } < 284 } < 285 < 286 if {![info exists fileNames(platformNeutral)]} then { < 287 set fileNames(platformNeutral) [list 1 1 1 1 0 0] < 288 < 289 if {![info exists no(symbols)]} then { < 290 lappend fileNames(platformNeutral) 0 | 444 [list buildNeutral platformNeutral] \ > 445 [list] [list] [list noRetail]] 291 } | 446 292 } < 293 < 294 if {![info exists fileNames(subst)]} then { < 295 set fileNames(subst) [list 1 1 1 0 0 0] < 296 < 297 if {![info exists no(symbols)]} then { 447 if {![info exists no(symbols)]} then { 298 lappend fileNames(subst) 0 | 448 lappend fileNames(flags) [list noRetail] 299 } < 300 } < 301 < 302 if {![info exists fileNames(noDebug)]} then { < 303 set fileNames(noDebug) [list 0 0 0 0 0 0] < 304 < 305 if {![info exists no(symbols)]} then { < 306 lappend fileNames(noDebug) 0 < 307 } < 308 } < 309 < 310 if {![info exists fileNames(noRetail)]} then { < 311 set fileNames(noRetail) [list 0 0 0 0 0 0] < 312 < 313 if {![info exists no(symbols)]} then { < 314 lappend fileNames(noRetail) 1 < 315 } 449 } 316 } 450 } 317 451 318 ############################################################################### 452 ############################################################################### 319 453 320 # 454 # 321 # NOTE: Setup the list of builds supported by this script. | 455 # NOTE: Setup the list of builds supported by this script. These may be > 456 # overridden via the user-specific customizations file. 322 # 457 # 323 if {![info exists buildNames]} then { 458 if {![info exists buildNames]} then { 324 set buildNames [list Debug Retail] 459 set buildNames [list Debug Retail] 325 } 460 } 326 461 327 ############################################################################### 462 ############################################################################### 328 463 329 # 464 # 330 # NOTE: Setup the list of platforms supported by this script. | 465 # NOTE: Setup the list of platforms supported by this script. These may be > 466 # overridden via the command line or the user-specific customizations > 467 # file. 331 # 468 # 332 if {![info exists platformNames]} then { 469 if {![info exists platformNames]} then { 333 set platformNames [list x86 x64 ARM] 470 set platformNames [list x86 x64 ARM] 334 } 471 } 335 472 336 ############################################################################### 473 ############################################################################### 337 474 338 # 475 # 339 # NOTE: Make sure the staging directory exists, creating it if necessary. 476 # NOTE: Make sure the staging directory exists, creating it if necessary. 340 # 477 # 341 file mkdir $stagingDirectory 478 file mkdir $stagingDirectory 342 479 343 # 480 # 344 # NOTE: Build the Tcl command used to extract the template package to the | 481 # NOTE: Build the Tcl command used to extract the template VSIX package to 345 # staging directory. | 482 # the staging directory. 346 # 483 # 347 set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory] 484 set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory] 348 485 349 # 486 # 350 # NOTE: Extract the template package to the staging directory. | 487 # NOTE: Extract the template VSIX package to the staging directory. 351 # 488 # 352 eval $extractCommand 489 eval $extractCommand 353 490 354 ############################################################################### 491 ############################################################################### 355 492 356 # 493 # 357 # NOTE: Process each file in the master file list. There are actually four | 494 # NOTE: Process each file in the master file list. There are actually three 358 # parallel lists that contain the source file names, destination file | 495 # parallel lists that contain the source file names, the destination file 359 # names, the platform-neutral flags, and the use-subst flags. When the | 496 # names, and the file processing flags. If the "buildNeutral" flag is 360 # platform-neutral flag is non-zero, the file is not platform-specific. | 497 # present, the file location and content do not depend on the build 361 # When the use-subst flag is non-zero, the file is considered to be a | 498 # configuration and "CommonConfiguration" will be used in place of the 362 # text file that may contain Tcl variable and/or command replacements, | 499 # build configuration name. If the "platformNeutral" flag is present, > 500 # the file location and content do not depend on the build platform and > 501 # "neutral" will be used in place of the build platform name. If the > 502 # "subst" flag is present, the file is assumed to be a text file that may > 503 # contain Tcl variable, command, and backslash replacements, to be 363 # to be dynamically replaced during processing. If the source file name | 504 # dynamically replaced during processing using the Tcl [subst] command. > 505 # If the "noDebug" flag is present, the file will be skipped when > 506 # processing for the debug build. If the "noRetail" flag is present, the > 507 # file will be skipped when processing for the retail build. If the > 508 # "move" flag is present, the source file will be deleted after it is > 509 # copied to the destination file. If the source file name is an empty 364 # is an empty string, then the destination file name will be assumed to | 510 # string, the destination file name will be assumed to already exist in 365 # already exist in the staging directory and will not be copied; however, | 511 # the staging directory and will not be copied; however, Tcl variable, 366 # dynamic replacements may still be performed on the destination file | 512 # command, and backslash replacements may still be performed on the 367 # prior to the package being re-zipped. < > 513 # destination file prior to the final VSIX package being built if the > 514 # "subst" flag is present. 368 # 515 # 369 foreach sourceFileName $fileNames(source) \ | 516 foreach sourceFileName $fileNames(source) \ 370 destinationFileName $fileNames(destination) \ | 517 destinationFileName $fileNames(destination) \ 371 buildNeutral $fileNames(buildNeutral) platformNeutral \ < 372 $fileNames(platformNeutral) useSubst $fileNames(subst) \ < 373 noDebug $fileNames(noDebug) noRetail $fileNames(noRetail) { < > 518 fileFlags $fileNames(flags) { 374 # 519 # > 520 # NOTE: Process the file flags into separate boolean variables that may be > 521 # used within the loop. > 522 # > 523 set isBuildNeutral [expr {[lsearch $fileFlags buildNeutral] != -1}] > 524 set isPlatformNeutral [expr {[lsearch $fileFlags platformNeutral] != -1}] > 525 set isMove [expr {[lsearch $fileFlags move] != -1}] > 526 set useSubst [expr {[lsearch $fileFlags subst] != -1}] > 527 > 528 # 375 # NOTE: If the current file is build-neutral, then only one build will 529 # NOTE: If the current file is build-neutral, then only one build will 376 # be processed for it, namely "CommonConfiguration"; otherwise, each 530 # be processed for it, namely "CommonConfiguration"; otherwise, each 377 # supported build will be processed for it individually. 531 # supported build will be processed for it individually. 378 # 532 # 379 foreach buildName \ 533 foreach buildName \ 380 [expr {$buildNeutral ? [list CommonConfiguration] : $buildNames}] { | 534 [expr {$isBuildNeutral ? [list CommonConfiguration] : $buildNames}] { 381 # 535 # 382 # NOTE: Should the current file be skipped for this build? 536 # NOTE: Should the current file be skipped for this build? 383 # 537 # 384 if {[info exists no${buildName}] && [set no${buildName}]} then { | 538 if {[lsearch $fileFlags no${buildName}] != -1} then { 385 continue 539 continue 386 } 540 } 387 541 388 # 542 # 389 # NOTE: If the current file is platform-neutral, then only one platform 543 # NOTE: If the current file is platform-neutral, then only one platform 390 # will be processed for it, namely "neutral"; otherwise, each 544 # will be processed for it, namely "neutral"; otherwise, each 391 # supported platform will be processed for it individually. 545 # supported platform will be processed for it individually. 392 # 546 # 393 foreach platformName \ 547 foreach platformName \ 394 [expr {$platformNeutral ? [list neutral] : $platformNames}] { | 548 [expr {$isPlatformNeutral ? [list neutral] : $platformNames}] { 395 # 549 # 396 # NOTE: Use the actual platform name in the destination file name. 550 # NOTE: Use the actual platform name in the destination file name. 397 # 551 # 398 set newDestinationFileName [replaceBuildAndPlatform \ | 552 set newDestinationFileName [replaceFileNameTokens $destinationFileName \ 399 $destinationFileName $buildName $platformName] | 553 $shortName $buildName $platformName] 400 554 401 # 555 # 402 # NOTE: Does the source file need to be copied to the destination file? 556 # NOTE: Does the source file need to be copied to the destination file? 403 # 557 # 404 if {[string length $sourceFileName] > 0} then { 558 if {[string length $sourceFileName] > 0} then { 405 # 559 # 406 # NOTE: First, make sure the destination directory exists. 560 # NOTE: First, make sure the destination directory exists. 407 # 561 # 408 file mkdir [file dirname $newDestinationFileName] 562 file mkdir [file dirname $newDestinationFileName] 409 563 410 # 564 # 411 # NOTE: Then, copy the source file to the destination file verbatim. 565 # NOTE: Then, copy the source file to the destination file verbatim. 412 # 566 # 413 file copy [replaceBuildAndPlatform $sourceFileName $buildName \ | 567 set newSourceFileName [replaceFileNameTokens $sourceFileName \ > 568 $shortName $buildName $platformName] > 569 414 $platformName] $newDestinationFileName | 570 file copy $newSourceFileName $newDestinationFileName > 571 > 572 # > 573 # NOTE: If this is a move instead of a copy, delete the source file > 574 # now. > 575 # > 576 if {$isMove} then { > 577 file delete $newSourceFileName > 578 } 415 } 579 } 416 580 417 # 581 # 418 # NOTE: Does the destination file contain dynamic replacements that must 582 # NOTE: Does the destination file contain dynamic replacements that must 419 # be processed now? 583 # be processed now? 420 # 584 # 421 if {$useSubst} then { 585 if {$useSubst} then { ................................................................................................................................................................................ 435 # NOTE: Change the current directory to the staging directory so that the 599 # NOTE: Change the current directory to the staging directory so that the 436 # external archive building tool can pickup the necessary files using 600 # external archive building tool can pickup the necessary files using 437 # relative paths. 601 # relative paths. 438 # 602 # 439 cd $stagingDirectory 603 cd $stagingDirectory 440 604 441 # 605 # 442 # NOTE: Build the Tcl command used to archive the final package in the | 606 # NOTE: Build the Tcl command used to archive the final VSIX package in the 443 # output directory. 607 # output directory. 444 # 608 # 445 set archiveCommand [list exec -- $zip -r $outputFile *] 609 set archiveCommand [list exec -- $zip -r $outputFile *] 446 610 447 # 611 # 448 # NOTE: Build the final package archive in the output directory. | 612 # NOTE: Build the final VSIX package archive in the output directory. 449 # 613 # 450 eval $archiveCommand 614 eval $archiveCommand 451 615 452 # 616 # 453 # NOTE: Change back to the previously saved current directory. 617 # NOTE: Change back to the previously saved current directory. 454 # 618 # 455 cd $currentDirectory 619 cd $currentDirectory

Changes to tool/win/sqlite.vsix

cannot compute difference between binary files