aboutsummaryrefslogtreecommitdiff
path: root/ports/sqlcipher
diff options
context:
space:
mode:
authorSvenPStarFinanz <spa@starfinanz.de>2020-10-14 01:13:13 +0200
committerGitHub <noreply@github.com>2020-10-13 16:13:13 -0700
commit50fb30f84c87a1cf30949fa840eb7c75123879a0 (patch)
tree532a36e4224f520b55ae6876a21053603e3cb79d /ports/sqlcipher
parent98c5261b40b830ac969f062f1569fe75be3e281c (diff)
downloadvcpkg-50fb30f84c87a1cf30949fa840eb7c75123879a0.tar.gz
vcpkg-50fb30f84c87a1cf30949fa840eb7c75123879a0.zip
[sqlcipher] Add new port (#13786)
* [sqlcipher] New port * Reformatted. * Update vcpkg.json * Update ports/sqlcipher/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Removed from baseline, because flagged in vcpkg.json. Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Diffstat (limited to 'ports/sqlcipher')
-rw-r--r--ports/sqlcipher/CMakeLists.txt71
-rw-r--r--ports/sqlcipher/portfile.cmake86
-rw-r--r--ports/sqlcipher/sqlcipher-config.in.cmake7
-rw-r--r--ports/sqlcipher/vcpkg.json22
4 files changed, 186 insertions, 0 deletions
diff --git a/ports/sqlcipher/CMakeLists.txt b/ports/sqlcipher/CMakeLists.txt
new file mode 100644
index 000000000..0a505139b
--- /dev/null
+++ b/ports/sqlcipher/CMakeLists.txt
@@ -0,0 +1,71 @@
+cmake_minimum_required(VERSION 3.10)
+project(sqlcipher C)
+
+find_package(OpenSSL REQUIRED)
+
+include_directories(. ${OPENSSL_INCLUDE_DIR})
+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()
+else()
+ set(API "-DSQLITE_API=extern")
+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()
+
+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()
+
+target_link_libraries(sqlcipher PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
+
+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()
+
+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/ports/sqlcipher/portfile.cmake b/ports/sqlcipher/portfile.cmake
new file mode 100644
index 000000000..3a0f6c5d5
--- /dev/null
+++ b/ports/sqlcipher/portfile.cmake
@@ -0,0 +1,86 @@
+vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
+
+vcpkg_fail_port_install( ON_TARGET "UWP" "OSX" "Linux")
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO sqlcipher/sqlcipher
+ REF v4.4.0
+ SHA512 e6e7b09cc079d75ac0b9e15a256bfe479ce97cfdece3244ca53e2e04b7f1dc1afdc1ee76d07f2629e614c7532cc80eeef6b85ba5952d31a2eaed8d6e84414628
+ 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)
+file(TO_NATIVE_PATH "${SOURCE_PATH}" SOURCE_PATH_NAT)
+
+# Determine TCL version (e.g. [path]tclsh90s.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}
+ ORIGINAL_SRC="${SOURCE_PATH_NAT}"
+ EXT_FEATURE_FLAGS=-DSQLITE_TEMP_STORE=2\ -DSQLITE_HAS_CODEC
+ LTLIBS=libcrypto.lib
+ LTLIBPATHS=/LIBPATH:"${CURRENT_INSTALLED_DIR}/lib/"
+)
+
+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 tcl
+ "${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
+ INVERTED_FEATURES
+ tool SQLITE3_SKIP_TOOLS
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS ${FEATURE_OPTIONS}
+ OPTIONS_DEBUG
+ -DSQLITE3_SKIP_TOOLS=ON
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT} TARGET_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 DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+
+vcpkg_copy_pdbs()
+vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
diff --git a/ports/sqlcipher/sqlcipher-config.in.cmake b/ports/sqlcipher/sqlcipher-config.in.cmake
new file mode 100644
index 000000000..308ea4715
--- /dev/null
+++ b/ports/sqlcipher/sqlcipher-config.in.cmake
@@ -0,0 +1,7 @@
+
+if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
+ include(CMakeFindDependencyMacro)
+ find_dependency(Threads)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/sqlcipher-targets.cmake)
diff --git a/ports/sqlcipher/vcpkg.json b/ports/sqlcipher/vcpkg.json
new file mode 100644
index 000000000..5165928f2
--- /dev/null
+++ b/ports/sqlcipher/vcpkg.json
@@ -0,0 +1,22 @@
+{
+ "name": "sqlcipher",
+ "version-string": "4.4.0",
+ "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",
+ "supports": "windows & !uwp & !static",
+ "dependencies": [
+ "openssl",
+ "tcl"
+ ],
+ "features": {
+ "geopoly": {
+ "description": "enable geopoly functionality for sqlite3"
+ },
+ "json1": {
+ "description": "enable JSON functionality for sqlite3"
+ },
+ "tool": {
+ "description": "sqlite3 executable"
+ }
+ }
+}