diff options
| author | 2021-03-13 21:33:39 +0100 | |
|---|---|---|
| committer | 2021-03-13 21:33:40 +0100 | |
| commit | ef808e9172f2e4fc90cf741c1d872e77fbb7125e (patch) | |
| tree | d2eabd075e00c16d9f8d1b7d8dd60761412b86d2 /build.zig | |
| parent | add two dockerfiles to build with debian and fedora (diff) | |
| download | zig-sqlite-ef808e9172f2e4fc90cf741c1d872e77fbb7125e.tar.gz zig-sqlite-ef808e9172f2e4fc90cf741c1d872e77fbb7125e.tar.xz zig-sqlite-ef808e9172f2e4fc90cf741c1d872e77fbb7125e.zip | |
build: fix building with glibc
sqlite3 requires at least glibc 2.28 from my testing; prevent building
the tests using anything below that.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 22 |
1 files changed, 21 insertions, 1 deletions
| @@ -13,7 +13,27 @@ fn linkSqlite(b: *std.build.LibExeObjStep) void { | |||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn build(b: *std.build.Builder) void { | 15 | pub fn build(b: *std.build.Builder) void { |
| 16 | const target = b.standardTargetOptions(.{}); | 16 | const target = blk: { |
| 17 | var tmp = b.standardTargetOptions(.{}); | ||
| 18 | |||
| 19 | if (tmp.isGnuLibC()) { | ||
| 20 | const min_glibc_version = std.builtin.Version{ | ||
| 21 | .major = 2, | ||
| 22 | .minor = 28, | ||
| 23 | .patch = 0, | ||
| 24 | }; | ||
| 25 | if (tmp.glibc_version) |ver| { | ||
| 26 | if (ver.order(min_glibc_version) == .lt) { | ||
| 27 | std.debug.panic("sqlite requires glibc version >= 2.28", .{}); | ||
| 28 | } | ||
| 29 | } else { | ||
| 30 | tmp.setGnuLibCVersion(2, 28, 0); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | break :blk tmp; | ||
| 35 | }; | ||
| 36 | |||
| 17 | const mode = b.standardReleaseOptions(); | 37 | const mode = b.standardReleaseOptions(); |
| 18 | 38 | ||
| 19 | const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; | 39 | const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; |