diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/sqlcipher | |
Diffstat (limited to 'vcpkg/ports/sqlcipher')
| -rw-r--r-- | vcpkg/ports/sqlcipher/CMakeLists.txt | 82 | ||||
| -rw-r--r-- | vcpkg/ports/sqlcipher/portfile.cmake | 81 | ||||
| -rw-r--r-- | vcpkg/ports/sqlcipher/sqlcipher-config.in.cmake | 8 | ||||
| -rw-r--r-- | vcpkg/ports/sqlcipher/vcpkg.json | 35 |
4 files changed, 206 insertions, 0 deletions
diff --git a/vcpkg/ports/sqlcipher/CMakeLists.txt b/vcpkg/ports/sqlcipher/CMakeLists.txt new file mode 100644 index 0000000..b9e826a --- /dev/null +++ b/vcpkg/ports/sqlcipher/CMakeLists.txt @@ -0,0 +1,82 @@ +cmake_minimum_required(VERSION 3.10) +project(sqlcipher C) + +find_package(OpenSSL REQUIRED) +if(BUILD_SHARED_LIBS) + if(UNIX) + set(API "-DSQLITE_API=__attribute__((visibility(\"default\")))") + elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + set(API "-DSQLITE_API=__declspec(dllexport)") + else() + message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}") + endif() +endif() +add_library(sqlcipher sqlite3.c) + +target_compile_definitions( + sqlcipher + PRIVATE + $<$<CONFIG:Debug>:SQLITE_DEBUG> + ${API} + -DSQLITE_ENABLE_RTREE + -DSQLITE_ENABLE_UNLOCK_NOTIFY + -DSQLITE_ENABLE_COLUMN_METADATA + -DSQLITE_HAS_CODEC + -DSQLITE_TEMP_STORE=2 +) + +if(WITH_GEOPOLY) + add_compile_definitions(SQLITE_ENABLE_GEOPOLY) +endif() + +if(WITH_JSON1) + add_compile_definitions(SQLITE_ENABLE_JSON1) +endif() + +if(WITH_FTS5) + add_compile_definitions(SQLITE_ENABLE_FTS5) +endif() + +target_include_directories(sqlcipher INTERFACE $<INSTALL_INTERFACE:include>) +if(NOT WIN32) + find_package(Threads REQUIRED) + target_link_libraries(sqlcipher PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) +endif() +if (UNIX AND NOT APPLE) + target_link_libraries(sqlcipher PRIVATE m) +endif() + +target_link_libraries(sqlcipher PRIVATE OpenSSL::SSL OpenSSL::Crypto) + +if(CMAKE_SYSTEM_NAME MATCHES "WindowsStore") + target_compile_definitions(sqlcipher PRIVATE -DSQLITE_OS_WINRT=1) +endif() + +if(NOT SQLITE3_SKIP_TOOLS) + add_executable(sqlcipher-bin shell.c) + target_link_libraries(sqlcipher-bin PRIVATE sqlcipher) + install(TARGETS sqlcipher-bin sqlcipher + RUNTIME DESTINATION tools/sqlcipher + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) +endif() + +SET(prefix "${CMAKE_INSTALL_PREFIX}") +SET(exec_prefix "\${prefix}") +SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +SET(includedir "\${prefix}/include") +SET(PACKAGE_VERSION ${SQLCIPHER_VERSION}) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sqlcipher.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/sqlcipher.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sqlcipher.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + +install( + TARGETS sqlcipher + EXPORT sqlcipher-targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(FILES sqlite3.h sqlite3ext.h DESTINATION include/sqlcipher CONFIGURATIONS Release) +install(EXPORT sqlcipher-targets NAMESPACE sqlcipher:: FILE sqlcipher-targets.cmake DESTINATION share/sqlcipher) diff --git a/vcpkg/ports/sqlcipher/portfile.cmake b/vcpkg/ports/sqlcipher/portfile.cmake new file mode 100644 index 0000000..ed9c663 --- /dev/null +++ b/vcpkg/ports/sqlcipher/portfile.cmake @@ -0,0 +1,81 @@ +vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO sqlcipher/sqlcipher
+ REF "v${VERSION}"
+ SHA512 023b2fc7248fe38b758ef93dd8436677ff0f5d08b1061e7eab0adb9e38ad92d523e0ab69016ee69bd35c1fd53c10f61e99b01f7a2987a1f1d492e1f7216a0a9c
+ HEAD_REF master
+)
+
+# Don't use vcpkg_build_nmake, because it doesn't handle nmake targets correctly.
+find_program(NMAKE nmake REQUIRED)
+
+# Find tclsh Executable needed for Amalgamation of SQLite
+file(GLOB TCLSH_CMD
+ ${CURRENT_INSTALLED_DIR}/tools/tcl/bin/tclsh*${VCPKG_HOST_EXECUTABLE_SUFFIX}
+)
+file(TO_NATIVE_PATH "${TCLSH_CMD}" TCLSH_CMD)
+
+# Determine TCL version (e.g. [path]tclsh90sx.exe -> 90)
+string(REGEX REPLACE ^.*tclsh "" TCLVERSION ${TCLSH_CMD})
+string(REGEX REPLACE [A-Za-z]*${VCPKG_HOST_EXECUTABLE_SUFFIX}$ "" TCLVERSION ${TCLVERSION})
+
+list(APPEND NMAKE_OPTIONS
+ TCLSH_CMD="${TCLSH_CMD}"
+ TCLVERSION=${TCLVERSION}
+ EXT_FEATURE_FLAGS=-DSQLITE_TEMP_STORE=2\ -DSQLITE_HAS_CODEC
+)
+
+set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
+
+# Creating amalgamation files
+message(STATUS "Pre-building ${TARGET_TRIPLET}")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f Makefile.msc /A /NOLOGO clean sqlite3.c
+ ${NMAKE_OPTIONS}
+ WORKING_DIRECTORY "${SOURCE_PATH}"
+ LOGNAME pre-build-${TARGET_TRIPLET}
+)
+message(STATUS "Pre-building ${TARGET_TRIPLET} done")
+
+# The rest of the build process with the CMakeLists.txt is merely a copy of sqlite3
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION "${SOURCE_PATH}")
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ geopoly WITH_GEOPOLY
+ json1 WITH_JSON1
+ fts5 WITH_FTS5
+ INVERTED_FEATURES
+ tool SQLITE3_SKIP_TOOLS
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DSQLCIPHER_VERSION=${VERSION}
+ OPTIONS_DEBUG
+ -DSQLITE3_SKIP_TOOLS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(PACKAGE_NAME ${PORT} CONFIG_PATH share/${PORT})
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+if(NOT SQLITE3_SKIP_TOOLS AND EXISTS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/sqlcipher-bin${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/tools/${PORT}/sqlcipher-bin${VCPKG_HOST_EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/sqlcipher${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+endif()
+
+configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/sqlcipher-config.in.cmake"
+ "${CURRENT_PACKAGES_DIR}/share/${PORT}/sqlcipher-config.cmake"
+ @ONLY
+)
+
+file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+
+vcpkg_copy_pdbs()
+vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+vcpkg_fixup_pkgconfig()
diff --git a/vcpkg/ports/sqlcipher/sqlcipher-config.in.cmake b/vcpkg/ports/sqlcipher/sqlcipher-config.in.cmake new file mode 100644 index 0000000..80d8a80 --- /dev/null +++ b/vcpkg/ports/sqlcipher/sqlcipher-config.in.cmake @@ -0,0 +1,8 @@ +include(CMakeFindDependencyMacro)
+
+find_dependency(OpenSSL)
+if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
+ find_dependency(Threads)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/sqlcipher-targets.cmake)
diff --git a/vcpkg/ports/sqlcipher/vcpkg.json b/vcpkg/ports/sqlcipher/vcpkg.json new file mode 100644 index 0000000..2692923 --- /dev/null +++ b/vcpkg/ports/sqlcipher/vcpkg.json @@ -0,0 +1,35 @@ +{ + "name": "sqlcipher", + "version": "4.6.1", + "port-version": 3, + "description": "SQLCipher extends the SQLite database library to add security enhancements that make it more suitable for encrypted local data storage.", + "homepage": "https://www.zetetic.net/sqlcipher", + "license": null, + "supports": "windows & !uwp", + "dependencies": [ + "openssl", + "tcl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "fts5": { + "description": "enable FTS5 functionality for sqlite3" + }, + "geopoly": { + "description": "enable geopoly functionality for sqlite3" + }, + "json1": { + "description": "enable JSON functionality for sqlite3" + }, + "tool": { + "description": "sqlite3 executable" + } + } +} |