Allow linking the system SQLite on Linux - #6
Merged
Conversation
Linux previously used the embedded swift-sqlcipher build. It now links the system libsqlite3 through a system library target declared with pkgConfig and apt/yum providers. Set SWIFT_BUILD_SQLCIPHER=1 to keep using the embedded build when the development package is unavailable.
Linux keeps using the embedded build by default, like the other non-Darwin platforms. Setting SWIFT_BUILD_SYSTEM_SQLITE=1 declares the CSQLite target and links the system libsqlite3 instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow Linux to link the system SQLite instead of the embedded swift-sqlcipher build.
Changes
CSQLitesystem library target (Sources/CSQLite) that wraps<sqlite3.h>and linkssqlite3, declared withpkgConfig: "sqlite3"and apt/yum providers.SWIFT_BUILD_SYSTEM_SQLITE=1opts Linux into it. The target is only declared in that case, so a default build never performs a pkg-config lookup.SwiftToolchainCSQLitetoCSQLite. The old module is toolchain-internal (swift-toolchain-sqlite) and not a supported import for package code; this makes the dependency explicit and declared.Linux (system SQLite)CI job that installslibsqlite3-devandpkg-configand builds with the opt-in set.pkg-configis required by thepkgConfig:declaration, not just the headers.Defaults
Unchanged. Linux still uses the embedded build, as do Android, Windows, WASI, and OpenBSD; Darwin still links
SQLite3.framework. Nothing here is a source break — consumers who don't set the env var see no difference, and the existing Linux CI job still covers that path.Testing
CSQLitepresent in the target list only underSWIFT_BUILD_SYSTEM_SQLITE=1.