Skip to content

Commit

Permalink
(#22710) sqlcipher: Add 4.5.6
Browse files Browse the repository at this point in the history
* sqlcipher: Add 4.5.6

* sqlcipher: Add 4.5.6

* sqlcipher: Fix topic case and add missing endline

* sqlcipher: Fix license for version >4.5.6

* do not enforce cmake in test package

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* sqlcipher: relax license filename to copy

Co-authored-by: Uilian Ries <uilianries@gmail.com>

* sqlcipher: Add option to enable column metadata

* sqlcipher: do not enforce cmake in test package #2

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
Alex-PLACET and uilianries authored Feb 14, 2024
1 parent c05d1e9 commit 02ff9d0
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 21 deletions.
7 changes: 7 additions & 0 deletions recipes/sqlcipher/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"4.5.6":
url: "https://github.com/sqlcipher/sqlcipher/archive/v4.5.6.zip"
sha256: "5d269166c33c39c4dc6fc14be4ac8cd78b022f8bd59b0775becf0c896331a539"
"4.5.1":
url: "https://github.com/sqlcipher/sqlcipher/archive/v4.5.1.zip"
sha256: "08a1024b299b5527d5b5ed79f67957938b516567f68662e973c4bec1b843b28e"
Expand All @@ -18,6 +21,10 @@ sources:
url: "https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.zip"
sha256: "41e1408465488e9c478ca5b7c5f8410405a10caa73b82db60ac115a76c563c05"
patches:
"4.5.6":
- patch_file: patches/Makefile.in-v4.5.6.patch
- patch_file: patches/Makefile.msc-v4.5.6.patch
- patch_file: patches/fix_configure-v4.5.6.patch
"4.5.1":
- patch_file: patches/Makefile.in-v4.5.1.patch
- patch_file: patches/Makefile.msc-v4.5.1.patch
Expand Down
11 changes: 8 additions & 3 deletions recipes/sqlcipher/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SqlcipherConan(ConanFile):
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.zetetic.net/sqlcipher/"
topics = ("database", "encryption", "SQLite")
topics = ("database", "encryption", "sqlite")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
Expand All @@ -30,13 +30,15 @@ class SqlcipherConan(ConanFile):
"crypto_library": ["openssl", "libressl", "commoncrypto"],
"with_largefile": [True, False],
"temporary_store": ["always_file", "default_file", "default_memory", "always_memory"],
"enable_column_metadata": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"crypto_library": "openssl",
"with_largefile": True,
"temporary_store": "default_memory",
"enable_column_metadata": False,
}

@property
Expand Down Expand Up @@ -114,7 +116,10 @@ def _generate_msvc(self):
env.define("OPTS", f'-I{crypto_dep.includedir} -DSQLITE_HAS_CODEC')
env.define("NO_TCL", "1")
env.define("USE_AMALGAMATION", "1")
env.define("OPT_FEATURE_FLAGS", "-DSQLCIPHER_CRYPTO_OPENSSL")
opt_feature_flags = "-DSQLCIPHER_CRYPTO_OPENSSL"
if self.options.enable_column_metadata:
opt_feature_flags += " -DSQLITE_ENABLE_COLUMN_METADATA"
env.define("OPT_FEATURE_FLAGS", opt_feature_flags)
env.define("SQLITE_TEMP_STORE", self._temp_store_nmake_value)
env.define("TCLSH_CMD", self.dependencies.build['tcl'].runenv_info.vars(self)['TCLSH'])

Expand Down Expand Up @@ -221,7 +226,7 @@ def build(self):
autotools.make()

def package(self):
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
if is_msvc(self):
copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False)
copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False)
Expand Down
25 changes: 25 additions & 0 deletions recipes/sqlcipher/all/patches/Makefile.in-v4.5.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/Makefile.in b/Makefile.in
index 870c5d30..4dc5d292 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -672,8 +672,7 @@ SQLITE3_SHELL_TARGET = $(SQLITE3_SHELL_TARGET_@HAVE_WASI_SDK@)
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
-all: sqlite3.h libsqlcipher.la $(SQLITE3_SHELL_TARGET) \
- $(HAVE_TCL:1=libtclsqlite3.la)
+all: sqlite3.h libsqlcipher.la

Makefile: $(TOP)/Makefile.in
./config.status
@@ -1557,9 +1556,8 @@ lib_install: libsqlcipher.la
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlcipher.la $(DESTDIR)$(libdir)

-install: sqlcipher$(TEXE) lib_install sqlite3.h sqlcipher.pc ${HAVE_TCL:1=tcl_install}
+install: lib_install sqlite3.h sqlcipher.pc
$(INSTALL) -d $(DESTDIR)$(bindir)
- $(LTINSTALL) sqlcipher$(TEXE) $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
161 changes: 161 additions & 0 deletions recipes/sqlcipher/all/patches/Makefile.msc-v4.5.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
diff --git a/Makefile.msc b/Makefile.msc
index 85487315..e3c00752 100644
--- a/Makefile.msc
+++ b/Makefile.msc
@@ -299,9 +299,9 @@ SQLITE3H = sqlite3.h
#
!IFNDEF SQLITE3DLL
!IF $(FOR_WIN10)!=0
-SQLITE3DLL = winsqlite3.dll
+SQLITE3DLL = sqlcipher.dll
!ELSE
-SQLITE3DLL = sqlite3.dll
+SQLITE3DLL = sqlcipher.dll
!ENDIF
!ENDIF

@@ -309,9 +309,9 @@ SQLITE3DLL = sqlite3.dll
#
!IFNDEF SQLITE3LIB
!IF $(FOR_WIN10)!=0
-SQLITE3LIB = winsqlite3.lib
+SQLITE3LIB = sqlcipher.lib
!ELSE
-SQLITE3LIB = sqlite3.lib
+SQLITE3LIB = sqlcipher.lib
!ENDIF
!ENDIF

@@ -696,7 +696,7 @@ SHELL_CORE_SRC = $(SQLITE3C)
SHELL_CORE_DEP = $(SQLITE3DLL)
# <<mark>>
!ELSEIF $(USE_AMALGAMATION)==0
-SHELL_CORE_DEP = libsqlite3.lib
+SHELL_CORE_DEP = sqlcipher.lib
# <</mark>>
!ELSE
SHELL_CORE_DEP =
@@ -719,7 +719,7 @@ TESTFIXTURE_DEP = zlib $(TESTFIXTURE_DEP)
SHELL_CORE_LIB = $(SQLITE3LIB)
# <<mark>>
!ELSEIF $(USE_AMALGAMATION)==0
-SHELL_CORE_LIB = libsqlite3.lib
+SHELL_CORE_LIB = sqlcipher.lib
# <</mark>>
!ELSE
SHELL_CORE_LIB =
@@ -754,8 +754,9 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
# C compiler options for the Windows 10 platform (needs MSVC 2015).
#
!IF $(FOR_WIN10)!=0
-TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
-BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+# /d2guard4 requires /guard:cf to be present as well, but it doesn't work with /Zi (Debug builds)
+TCC = $(TCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+BCC = $(BCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
!ENDIF

# Also, we need to dynamically link to the correct MSVC runtime
@@ -1039,8 +1040,10 @@ TLIBS =
# default to file, 2 to default to memory, and 3 to force temporary
# tables to always be in memory.
#
-TCC = $(TCC) -DSQLITE_TEMP_STORE=1
-RCC = $(RCC) -DSQLITE_TEMP_STORE=1
+
+# Allow overriding the value
+TCC = $(TCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE)
+RCC = $(RCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE)

# Enable/disable loadable extensions, and other optional features
# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
@@ -1206,14 +1209,15 @@ LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
!ENDIF
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
-LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
+# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL
!ENDIF

# When compiling for UWP or the Windows 10 platform, some extra linker
# options are also required.
#
!IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
-LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
+# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL
+LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
LTLINKOPTS = $(LTLINKOPTS) mincore.lib
!IFDEF PSDKLIBPATH
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
@@ -1268,7 +1272,7 @@ LTLIBS = $(LTLIBS) $(LIBICU)
#
LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
- callback.lo complete.lo ctime.lo \
+ callback.lo complete.lo crypto.lo crypto_impl.lo crypto_openssl.lo ctime.lo \
date.lo dbpage.lo dbstat.lo delete.lo \
expr.lo fault.lo fkey.lo \
fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
@@ -1774,7 +1778,7 @@ ALL_TCL_TARGETS =
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
-core: dll libsqlite3.lib shell
+core: dll sqlcipher.lib shell

# Targets that require the Tcl library.
#
@@ -1793,11 +1797,12 @@ dll: $(SQLITE3DLL)
shell: $(SQLITE3EXE)

# <<mark>>
-libsqlite3.lib: $(LIBOBJ)
- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
+# LTLIBPATHS is required to find the openssl/libressl libs
+sqlcipher.lib: $(LIBOBJ)
+ $(LTLIB) $(LTLIBPATHS) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)

-libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
- $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
+libtclsqlite3.lib: tclsqlite.lo sqlcipher.lib
+ $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo sqlcipher.lib $(LIBTCLSTUB) $(TLIBS)

tclsqlite3.def: tclsqlite.lo
echo EXPORTS > tclsqlite3.def
@@ -1819,9 +1824,9 @@ $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)

# <<block2>>
-sqlite3.def: libsqlite3.lib
+sqlite3.def: sqlcipher.lib
echo EXPORTS > sqlite3.def
- dumpbin /all libsqlite3.lib \
+ dumpbin /all sqlcipher.lib \
| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@]*)(?:@\d+)?$$" \1 \
| sort >> sqlite3.def
# <</block2>>
@@ -2008,6 +2013,15 @@ callback.lo: $(TOP)\src\callback.c $(HDR)
complete.lo: $(TOP)\src\complete.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c

+crypto.lo: $(TOP)\src\crypto.c $(HDR)
+ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto.c
+
+crypto_impl.lo: $(TOP)\src\crypto_impl.c $(HDR)
+ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_impl.c
+
+crypto_openssl.lo: $(TOP)\src\crypto_openssl.c $(HDR)
+ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_openssl.c
+
ctime.lo: $(TOP)\src\ctime.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c

@@ -2427,7 +2441,7 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR)
# Rules to build the 'testfixture' application.
#
# If using the amalgamation, use sqlite3.c directly to build the test
-# fixture. Otherwise link against libsqlite3.lib. (This distinction is
+# fixture. Otherwise link against sqlcipher.lib. (This distinction is
# necessary because the test fixture requires non-API symbols which are
# hidden when the library is built via the amalgamation).
#
20 changes: 20 additions & 0 deletions recipes/sqlcipher/all/patches/fix_configure-v4.5.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/configure b/configure
index a2909ce..9c25987 100755
--- a/configure
+++ b/configure
@@ -12732,7 +12732,6 @@ then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

@@ -12764,7 +12763,6 @@ if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes
then :
printf "%s\n" "#define HAVE_LIBCRYPTO 1" >>confdefs.h

- LIBS="-lcrypto $LIBS"

else $as_nop
as_fn_error $? "Library crypto not found. Install openssl!\"" "$LINENO" 5
9 changes: 0 additions & 9 deletions recipes/sqlcipher/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ class TestPackageConan(ConanFile):
def requirements(self):
self.requires(self.tested_reference_str)

def build_requirements(self):
if is_apple_os(self) and self.settings.arch == "armv8":
# Workaround for CMake bug with error message:
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being
# set. This could be because you are using a Mac OS X version less than 10.5
# or because CMake's platform configuration is corrupt.
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded.
self.tool_requires("cmake/[>=3.22]")

def layout(self):
cmake_layout(self)

Expand Down
9 changes: 0 additions & 9 deletions recipes/sqlcipher/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build_requirements(self):
if is_apple_os(self) and self.settings.arch == "armv8":
# Workaround for CMake bug with error message:
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being
# set. This could be because you are using a Mac OS X version less than 10.5
# or because CMake's platform configuration is corrupt.
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded.
self.build_requires("cmake/3.22.0")

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down
2 changes: 2 additions & 0 deletions recipes/sqlcipher/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"4.5.6":
folder: all
"4.5.1":
folder: all
"4.5.0":
Expand Down

0 comments on commit 02ff9d0

Please sign in to comment.