Skip to content

Commit 0ccfc50

Browse files
committed
utils: migrate away from fetched SQLite
With the introduction of swift-toolchain-sqlite, we have a version of SQLite that we can use to build the toolchain. Prefer this over the fetched amalgamation which simplifies the logic for the toolchain and ensures that we are able to track this as a regular component.
1 parent 920c560 commit 0ccfc50

File tree

1 file changed

+10
-44
lines changed

1 file changed

+10
-44
lines changed

utils/build.ps1

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,44 +1874,10 @@ function Install-Platform([Platform]$Platform, $Arch) {
18741874
}
18751875

18761876
function Build-SQLite($Arch) {
1877-
$SrcPath = "$SourceCache\sqlite-3.43.2"
1878-
1879-
# Download the sources
1880-
if (-not (Test-Path $SrcPath)) {
1881-
$ZipPath = "$env:TEMP\sqlite-amalgamation-3430200.zip"
1882-
if (-not $ToBatch) { Remove-item $ZipPath -ErrorAction Ignore | Out-Null }
1883-
Invoke-Program curl.exe -- -sL https://sqlite.org/2023/sqlite-amalgamation-3430200.zip -o $ZipPath
1884-
1885-
if (-not $ToBatch) { New-Item -Type Directory -Path $SrcPath -ErrorAction Ignore | Out-Null }
1886-
Invoke-Program "$UnixToolsBinDir\unzip.exe" -- -j -o $ZipPath -d $SrcPath
1887-
if (-not $ToBatch) { Remove-item $ZipPath | Out-Null }
1888-
1889-
if (-not $ToBatch) {
1890-
# Inject a CMakeLists.txt so we can build sqlite
1891-
@"
1892-
cmake_minimum_required(VERSION 3.12.3)
1893-
project(SQLite LANGUAGES C)
1894-
1895-
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
1896-
add_library(SQLite3 sqlite3.c)
1897-
1898-
if(CMAKE_SYSTEM_NAME STREQUAL Windows AND BUILD_SHARED_LIBS)
1899-
target_compile_definitions(SQLite3 PRIVATE "SQLITE_API=__declspec(dllexport)")
1900-
endif()
1901-
1902-
install(TARGETS SQLite3
1903-
ARCHIVE DESTINATION lib
1904-
LIBRARY DESTINATION lib
1905-
RUNTIME DESTINATION bin)
1906-
install(FILES sqlite3.h sqlite3ext.h DESTINATION include)
1907-
"@ | Out-File -Encoding UTF8 $SrcPath\CMakeLists.txt
1908-
}
1909-
}
1910-
19111877
Build-CMakeProject `
1912-
-Src $SrcPath `
1913-
-Bin "$($Arch.BinaryCache)\sqlite-3.43.2" `
1914-
-InstallTo $LibraryRoot\sqlite-3.43.2\usr `
1878+
-Src $SourceCache\swift-toolchain-sqlite `
1879+
-Bin "$($Arch.BinaryCache)\sqlite-3.46.0" `
1880+
-InstallTo $LibraryRoot\sqlite-3.46.0\usr `
19151881
-Arch $Arch `
19161882
-UseMSVCCompilers C `
19171883
-BuildTargets default `
@@ -1993,8 +1959,8 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
19931959
-Defines ($TestingDefines + @{
19941960
BUILD_SHARED_LIBS = "YES";
19951961
LLBUILD_SUPPORT_BINDINGS = "Swift";
1996-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
1997-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
1962+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
1963+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
19981964
})
19991965
}
20001966
}
@@ -2047,8 +2013,8 @@ function Build-Driver($Arch) {
20472013
LLBuild_DIR = (Get-HostProjectCMakeModules LLBuild);
20482014
Yams_DIR = (Get-HostProjectCMakeModules Yams);
20492015
ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
2050-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
2051-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
2016+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
2017+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
20522018
SWIFT_DRIVER_BUILD_TOOLS = "YES";
20532019
LLVM_DIR = "$(Get-HostProjectBinaryCache Compilers)\lib\cmake\llvm";
20542020
Clang_DIR = "$(Get-HostProjectBinaryCache Compilers)\lib\cmake\clang";
@@ -2143,8 +2109,8 @@ function Build-PackageManager($Arch) {
21432109
SwiftASN1_DIR = (Get-HostProjectCMakeModules ASN1);
21442110
SwiftCertificates_DIR = (Get-HostProjectCMakeModules Certificates);
21452111
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2146-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
2147-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
2112+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
2113+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
21482114
}
21492115
}
21502116

@@ -2303,7 +2269,7 @@ function Test-PackageManager() {
23032269
-Src $SrcDir `
23042270
-Bin $OutDir `
23052271
-Arch $HostArch `
2306-
-Xcc "-I$LibraryRoot\sqlite-3.43.2\usr\include" -Xlinker "-L$LibraryRoot\sqlite-3.43.2\usr\lib"
2272+
-Xcc "-I$LibraryRoot\sqlite-3.46.0\usr\include" -Xlinker "-L$LibraryRoot\sqlite-3.46.0\usr\lib"
23072273
}
23082274
}
23092275

0 commit comments

Comments
 (0)