Skip to content

Commit cc6643c

Browse files
authored
Merge pull request #330 from sparklemotion/flavorjones-extconf-help-message
ext: smarter sqlcipher config params, and a user help message
2 parents d243a4d + 67296f7 commit cc6643c

1 file changed

Lines changed: 83 additions & 1 deletion

File tree

ext/sqlite3/extconf.rb

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def libname
3636
end
3737

3838
def sqlcipher?
39-
with_config("sqlcipher")
39+
with_config("sqlcipher") ||
40+
with_config("sqlcipher-dir") ||
41+
with_config("sqlcipher-include") ||
42+
with_config("sqlcipher-lib")
4043
end
4144

4245
def configure_system_libraries
@@ -147,10 +150,89 @@ def cross_build?
147150
def download
148151
minimal_recipe.download
149152
end
153+
154+
def print_help
155+
print(<<~TEXT)
156+
USAGE: ruby #{$PROGRAM_NAME} [options]
157+
158+
Flags that are always valid:
159+
160+
--disable-system-libraries
161+
Use the packaged libraries, and ignore the system libraries.
162+
(This is the default behavior.)
163+
164+
--enable-system-libraries
165+
Use system libraries instead of building and using the packaged libraries.
166+
167+
--with-sqlcipher
168+
Use libsqlcipher instead of libsqlite3.
169+
(Implies `--enable-system-libraries`.)
170+
171+
--help
172+
Display this message.
173+
174+
175+
Flags only used when using system libraries:
176+
177+
General (applying to all system libraries):
178+
179+
--with-opt-dir=DIRECTORY
180+
Look for headers and libraries in DIRECTORY.
181+
182+
--with-opt-lib=DIRECTORY
183+
Look for libraries in DIRECTORY.
184+
185+
--with-opt-include=DIRECTORY
186+
Look for headers in DIRECTORY.
187+
188+
Related to sqlcipher:
189+
190+
--with-sqlcipher-dir=DIRECTORY
191+
Look for sqlcipher headers and library in DIRECTORY.
192+
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
193+
194+
--with-sqlcipher-lib=DIRECTORY
195+
Look for sqlcipher library in DIRECTORY.
196+
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
197+
198+
--with-sqlcipher-include=DIRECTORY
199+
Look for sqlcipher headers in DIRECTORY.
200+
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
201+
202+
203+
Flags only used when building and using the packaged libraries:
204+
205+
--enable-cross-build
206+
Enable cross-build mode. (You probably do not want to set this manually.)
207+
208+
209+
Environment variables used for compiling the C extension:
210+
211+
CC
212+
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
213+
214+
215+
Environment variables passed through to the compilation of packaged libraries:
216+
217+
CC
218+
CPPFLAGS
219+
CFLAGS
220+
LDFLAGS
221+
LIBS
222+
LT_SYS_LIBRARY_PATH
223+
CPP
224+
225+
TEXT
226+
end
150227
end
151228
end
152229
end
153230

231+
if arg_config("--help")
232+
Sqlite3::ExtConf.print_help
233+
exit!(0)
234+
end
235+
154236
if arg_config("--download-dependencies")
155237
Sqlite3::ExtConf.download
156238
exit!(0)

0 commit comments

Comments
 (0)