Skip to content

Commit

Permalink
allow for header in sqlcipher folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg authored and flavorjones committed Aug 9, 2022
1 parent b6a7cc2 commit cba4d66
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sqlite3-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ jobs:
apt-get: "libsqlcipher-dev"
brew: "sqlcipher"
mingw: "sqlcipher"
vcpkg: "sqlite3 sqlcipher"
vcpkg: "sqlcipher"
- run: bundle exec rake compile -- --with-sqlcipher
- run: bundle exec rake test
9 changes: 8 additions & 1 deletion ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ def configure_extension
append_cflags("-DTAINTING_SUPPORT")
end

abort_could_not_find("sqlite3.h") unless find_header("sqlite3.h")
if find_header("sqlite3.h")
# noop
elsif find_header("#{libname}/sqlite3.h")
$defs.push "-DHAVE_LIB_FLDR"
else
abort_could_not_find("sqlite3.h")
end

abort_could_not_find(libname) unless find_library(libname, "sqlite3_libversion_number", "sqlite3.h")

# double-check that we're using the expected library (sqlite3 or sqlcipher)
Expand Down
5 changes: 4 additions & 1 deletion ext/sqlite3/sqlite3_ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#define SQLITE3_UTF8_STR_NEW2(_obj) \
(rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))


#ifdef HAVE_LIB_FLDR /* only occurs with sqlcipher? */
#include <sqlcipher/sqlite3.h>
#else
#include <sqlite3.h>
#endif

#ifndef HAVE_TYPE_SQLITE3_INT64
typedef sqlite_int64 sqlite3_int64;
Expand Down

0 comments on commit cba4d66

Please sign in to comment.