Skip to content

Commit ca2d053

Browse files
committed
Allow turning off loadable extensions
1 parent ed27c9e commit ca2d053

File tree

6 files changed

+124
-19
lines changed

6 files changed

+124
-19
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ for testing various features of this library.
3333
SQLite3-OCaml depends on `pkg-config` to locate and compile against an
3434
[SQLite3](http://www.sqlite.org) library.
3535

36-
If the SQLite3 version is larger than or equal to 3.3.7, it is assumed that it
36+
If the SQLite3 version is greater than or equal to 3.3.7, it is assumed that it
3737
supports [Run-Time Loadable Extensions](http://www.sqlite.org/loadext.html).
38-
If this feature has been explicitly disabled in the library, the build will
39-
fail with:
38+
If this feature has been explicitly disabled in the library, building
39+
applications will fail with:
4040

4141
```
4242
Undefined symbols for architecture ...:
@@ -54,6 +54,11 @@ Undefined symbols for architecture ...:
5454
environment variable; this will instruct the build to see if a _brewed_
5555
version of SQLite is installed and route `pkg-config` appropriately.
5656

57+
* You can explicitly disable run-time loadable extensions by calling
58+
`configure` with the flag `--disable-loadable-extensions` or by setting
59+
the environment variable `SQLITE3_DISABLE_LOADABLE_EXTENSIONS` if linking
60+
problems persist.
61+
5762
Credits
5863
-------
5964

@@ -80,4 +85,4 @@ page](https://github.com/mmottl/sqlite3-ocaml).
8085

8186
Enjoy!
8287

83-
Markus Mottl on December 15, 2015
88+
Markus Mottl on January 5, 2015

_oasis

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OASISFormat: 0.4
22
Name: sqlite3
3-
Version: 4.0.2
3+
Version: 4.0.3
44
Synopsis: sqlite3-ocaml - SQLite3 bindings
55
Description: sqlite3-ocaml is an OCaml library with bindings to the
66
SQLite3 client API. Sqlite3 is a self-contained, serverless,
@@ -12,7 +12,7 @@ Description: sqlite3-ocaml is an OCaml library with bindings to the
1212
Authors: Markus Mottl <[email protected]>,
1313
Christian Szegedy <[email protected]>
1414
Copyrights: (C) 2007-2010 Jane Street Holding LLC <[email protected]>,
15-
(C) 2010-2015 Markus Mottl <[email protected]>,
15+
(C) 2010-2016 Markus Mottl <[email protected]>,
1616
(C) 2005-2012 Christian Szegedy <[email protected]>
1717
Maintainers: Markus Mottl <[email protected]>,
1818
Christian Szegedy <[email protected]>
@@ -37,14 +37,20 @@ Flag brewcheck
3737
Description: Try to check against a homebrewed sqlite3
3838
Default: false
3939

40+
Flag loadable_extensions
41+
Description: Enable loadable extensions
42+
Default: true
43+
4044
Library sqlite3
4145
Path: lib
4246
FindlibName: sqlite3
4347
Modules: Sqlite3
4448
CSources: sqlite3_stubs.c
4549
CCOpt: -g -O2 -fPIC -DPIC
4650
if flag(strict) && ccomp_type(cc)
47-
CCOpt+: -Wall -pedantic -Wextra -Wunused -Wno-long-long
51+
CCOpt+: -Wall -pedantic -Wextra -Wunused -Wno-long-long -Wno-keyword-macro
52+
if !flag(loadable_extensions)
53+
CCOpt+: -DSQLITE3_DISABLE_LOADABLE_EXTENSIONS
4854
CCLib: -lsqlite3 -lpthread
4955

5056

lib/META

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 5524efdf2a9ea85569fd9184ad5804ae)
3-
version = "4.0.2"
2+
# DO NOT EDIT (digest: fa8ee36501416c86cd1e145c553d9aae)
3+
version = "4.0.3"
44
description = "sqlite3-ocaml - SQLite3 bindings"
55
archive(byte) = "sqlite3.cma"
66
archive(byte, plugin) = "sqlite3.cma"

lib/sqlite3_stubs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# define inline
5050
#endif
5151

52-
#if SQLITE_VERSION_NUMBER >= 3003007
52+
#if SQLITE_VERSION_NUMBER >= 3003007 && !SQLITE3_DISABLE_LOADABLE_EXTENSIONS
5353
# define SQLITE_HAS_ENABLE_LOAD_EXTENSION
5454
#endif
5555

myocamlbuild.ml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* OASIS_START *)
2-
(* DO NOT EDIT (digest: 1308fb3d48472c2edc4cc51c862b6705) *)
2+
(* DO NOT EDIT (digest: ef3f6bb7de5d2441c8248057cdf28ea3) *)
33
module OASISGettext = struct
44
(* # 22 "src/oasis/OASISGettext.ml" *)
55

@@ -625,6 +625,20 @@ let package_default =
625625
A "-ccopt";
626626
A "-DPIC"
627627
]);
628+
(OASISExpr.ENot (OASISExpr.EFlag "loadable_extensions"),
629+
S
630+
[
631+
A "-ccopt";
632+
A "-g";
633+
A "-ccopt";
634+
A "-O2";
635+
A "-ccopt";
636+
A "-fPIC";
637+
A "-ccopt";
638+
A "-DPIC";
639+
A "-ccopt";
640+
A "-DSQLITE3_DISABLE_LOADABLE_EXTENSIONS"
641+
]);
628642
(OASISExpr.EAnd
629643
(OASISExpr.EFlag "strict",
630644
OASISExpr.ETest ("ccomp_type", "cc")),
@@ -647,7 +661,39 @@ let package_default =
647661
A "-ccopt";
648662
A "-Wunused";
649663
A "-ccopt";
650-
A "-Wno-long-long"
664+
A "-Wno-long-long";
665+
A "-ccopt";
666+
A "-Wno-keyword-macro"
667+
]);
668+
(OASISExpr.EAnd
669+
(OASISExpr.EAnd
670+
(OASISExpr.EFlag "strict",
671+
OASISExpr.ETest ("ccomp_type", "cc")),
672+
OASISExpr.ENot (OASISExpr.EFlag "loadable_extensions")),
673+
S
674+
[
675+
A "-ccopt";
676+
A "-g";
677+
A "-ccopt";
678+
A "-O2";
679+
A "-ccopt";
680+
A "-fPIC";
681+
A "-ccopt";
682+
A "-DPIC";
683+
A "-ccopt";
684+
A "-Wall";
685+
A "-ccopt";
686+
A "-pedantic";
687+
A "-ccopt";
688+
A "-Wextra";
689+
A "-ccopt";
690+
A "-Wunused";
691+
A "-ccopt";
692+
A "-Wno-long-long";
693+
A "-ccopt";
694+
A "-Wno-keyword-macro";
695+
A "-ccopt";
696+
A "-DSQLITE3_DISABLE_LOADABLE_EXTENSIONS"
651697
])
652698
]);
653699
(["oasis_library_sqlite3_cclib"; "link"],
@@ -666,7 +712,7 @@ let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
666712

667713
let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
668714

669-
# 670 "myocamlbuild.ml"
715+
# 716 "myocamlbuild.ml"
670716
(* OASIS_STOP *)
671717

672718
let read_lines_from_cmd ~max_lines cmd =
@@ -755,6 +801,15 @@ let () =
755801
| [cflags] -> S (ocamlify ~ocaml_flag:"-ccopt" cflags)
756802
| _ -> failwith "pkg-config failed for cflags"
757803
in
804+
let osqlite3_cflags =
805+
try
806+
ignore (Sys.getenv "SQLITE3_DISABLE_LOADABLE_EXTENSIONS");
807+
S [
808+
A "-ccopt"; A "-DSQLITE3_DISABLE_LOADABLE_EXTENSIONS";
809+
osqlite3_cflags
810+
]
811+
with _ -> osqlite3_cflags
812+
in
758813
let sqlite3_clibs, osqlite3_clibs =
759814
let cmd = pkg_export ^ " pkg-config --libs sqlite3" in
760815
match read_lines_from_cmd ~max_lines:1 cmd with

setup.ml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* setup.ml generated for the first time by OASIS v0.3.0 *)
22

33
(* OASIS_START *)
4-
(* DO NOT EDIT (digest: 4f2751487ce181081e99de1028e4c41a) *)
4+
(* DO NOT EDIT (digest: 34b827fa7f40294929d50e745345a17a) *)
55
(*
66
Regenerated by OASIS v0.4.5
77
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6981,7 +6981,7 @@ let setup_t =
69816981
alpha_features = [];
69826982
beta_features = [];
69836983
name = "sqlite3";
6984-
version = "4.0.2";
6984+
version = "4.0.3";
69856985
license =
69866986
OASISLicense.DEP5License
69876987
(OASISLicense.DEP5Unit
@@ -6994,7 +6994,7 @@ let setup_t =
69946994
copyrights =
69956995
[
69966996
"(C) 2007-2010 Jane Street Holding LLC <[email protected]>";
6997-
"(C) 2010-2015 Markus Mottl <[email protected]>";
6997+
"(C) 2010-2016 Markus Mottl <[email protected]>";
69986998
"(C) 2005-2012 Christian Szegedy <[email protected]>"
69996999
];
70007000
maintainers =
@@ -7073,6 +7073,16 @@ let setup_t =
70737073
Some "Try to check against a homebrewed sqlite3";
70747074
flag_default = [(OASISExpr.EBool true, false)]
70757075
});
7076+
Flag
7077+
({
7078+
cs_name = "loadable_extensions";
7079+
cs_data = PropList.Data.create ();
7080+
cs_plugin_data = []
7081+
},
7082+
{
7083+
flag_description = Some "Enable loadable extensions";
7084+
flag_default = [(OASISExpr.EBool true, true)]
7085+
});
70767086
Library
70777087
({
70787088
cs_name = "sqlite3";
@@ -7093,6 +7103,15 @@ let setup_t =
70937103
[
70947104
(OASISExpr.EBool true,
70957105
["-g"; "-O2"; "-fPIC"; "-DPIC"]);
7106+
(OASISExpr.ENot
7107+
(OASISExpr.EFlag "loadable_extensions"),
7108+
[
7109+
"-g";
7110+
"-O2";
7111+
"-fPIC";
7112+
"-DPIC";
7113+
"-DSQLITE3_DISABLE_LOADABLE_EXTENSIONS"
7114+
]);
70967115
(OASISExpr.EAnd
70977116
(OASISExpr.EFlag "strict",
70987117
OASISExpr.ETest ("ccomp_type", "cc")),
@@ -7105,7 +7124,27 @@ let setup_t =
71057124
"-pedantic";
71067125
"-Wextra";
71077126
"-Wunused";
7108-
"-Wno-long-long"
7127+
"-Wno-long-long";
7128+
"-Wno-keyword-macro"
7129+
]);
7130+
(OASISExpr.EAnd
7131+
(OASISExpr.EAnd
7132+
(OASISExpr.EFlag "strict",
7133+
OASISExpr.ETest ("ccomp_type", "cc")),
7134+
OASISExpr.ENot
7135+
(OASISExpr.EFlag "loadable_extensions")),
7136+
[
7137+
"-g";
7138+
"-O2";
7139+
"-fPIC";
7140+
"-DPIC";
7141+
"-Wall";
7142+
"-pedantic";
7143+
"-Wextra";
7144+
"-Wunused";
7145+
"-Wno-long-long";
7146+
"-Wno-keyword-macro";
7147+
"-DSQLITE3_DISABLE_LOADABLE_EXTENSIONS"
71097148
])
71107149
];
71117150
bs_cclib =
@@ -7523,14 +7562,14 @@ let setup_t =
75237562
};
75247563
oasis_fn = Some "_oasis";
75257564
oasis_version = "0.4.5";
7526-
oasis_digest = Some "\tÿ¾%³~;¹×\t=ïÿ\\¶";
7565+
oasis_digest = Some "\026Á2=èì-\007\130\026ù\151Ù ";
75277566
oasis_exec = None;
75287567
oasis_setup_args = [];
75297568
setup_update = false
75307569
};;
75317570

75327571
let setup () = BaseSetup.setup setup_t;;
75337572

7534-
# 7535 "setup.ml"
7573+
# 7574 "setup.ml"
75357574
(* OASIS_STOP *)
75367575
let () = setup ();;

0 commit comments

Comments
 (0)