Skip to content

Commit cba4d66

Browse files
MSP-Gregflavorjones
authored andcommitted
allow for header in sqlcipher folder
1 parent b6a7cc2 commit cba4d66

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/sqlite3-ruby.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ jobs:
101101
apt-get: "libsqlcipher-dev"
102102
brew: "sqlcipher"
103103
mingw: "sqlcipher"
104-
vcpkg: "sqlite3 sqlcipher"
104+
vcpkg: "sqlcipher"
105105
- run: bundle exec rake compile -- --with-sqlcipher
106106
- run: bundle exec rake test

ext/sqlite3/extconf.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ def configure_extension
7878
append_cflags("-DTAINTING_SUPPORT")
7979
end
8080

81-
abort_could_not_find("sqlite3.h") unless find_header("sqlite3.h")
81+
if find_header("sqlite3.h")
82+
# noop
83+
elsif find_header("#{libname}/sqlite3.h")
84+
$defs.push "-DHAVE_LIB_FLDR"
85+
else
86+
abort_could_not_find("sqlite3.h")
87+
end
88+
8289
abort_could_not_find(libname) unless find_library(libname, "sqlite3_libversion_number", "sqlite3.h")
8390

8491
# double-check that we're using the expected library (sqlite3 or sqlcipher)

ext/sqlite3/sqlite3_ruby.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
#define SQLITE3_UTF8_STR_NEW2(_obj) \
2222
(rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))
2323

24-
24+
#ifdef HAVE_LIB_FLDR /* only occurs with sqlcipher? */
25+
#include <sqlcipher/sqlite3.h>
26+
#else
2527
#include <sqlite3.h>
28+
#endif
2629

2730
#ifndef HAVE_TYPE_SQLITE3_INT64
2831
typedef sqlite_int64 sqlite3_int64;

0 commit comments

Comments
 (0)