diff options
| author | 2021-03-13 22:10:31 +0100 | |
|---|---|---|
| committer | 2021-03-13 22:10:31 +0100 | |
| commit | 8f3619d4cfc35a525cf1c7e804d4f78961a07ea6 (patch) | |
| tree | 8e83694c43fadd661a11b8c2a807b917195daffd | |
| parent | Merge branch 'build-glibc' (diff) | |
| download | zig-sqlite-8f3619d4cfc35a525cf1c7e804d4f78961a07ea6.tar.gz zig-sqlite-8f3619d4cfc35a525cf1c7e804d4f78961a07ea6.tar.xz zig-sqlite-8f3619d4cfc35a525cf1c7e804d4f78961a07ea6.zip | |
build: fix building _without_ the bundled source code
| -rw-r--r-- | build.zig | 17 |
1 files changed, 11 insertions, 6 deletions
| @@ -12,9 +12,9 @@ fn linkSqlite(b: *std.build.LibExeObjStep) void { | |||
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn build(b: *std.build.Builder) void { | 15 | fn getTarget(original_target: std.zig.CrossTarget, bundled: bool) std.zig.CrossTarget { |
| 16 | const target = blk: { | 16 | if (bundled) { |
| 17 | var tmp = b.standardTargetOptions(.{}); | 17 | var tmp = original_target; |
| 18 | 18 | ||
| 19 | if (tmp.isGnuLibC()) { | 19 | if (tmp.isGnuLibC()) { |
| 20 | const min_glibc_version = std.builtin.Version{ | 20 | const min_glibc_version = std.builtin.Version{ |
| @@ -31,15 +31,20 @@ pub fn build(b: *std.build.Builder) void { | |||
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | break :blk tmp; | 34 | return tmp; |
| 35 | }; | 35 | } |
| 36 | 36 | ||
| 37 | const mode = b.standardReleaseOptions(); | 37 | return original_target; |
| 38 | } | ||
| 38 | 39 | ||
| 40 | pub fn build(b: *std.build.Builder) void { | ||
| 39 | const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; | 41 | const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; |
| 40 | const dbfile = b.option([]const u8, "dbfile", "Always use this database file instead of a temporary one"); | 42 | const dbfile = b.option([]const u8, "dbfile", "Always use this database file instead of a temporary one"); |
| 41 | const use_bundled = b.option(bool, "use_bundled", "Use the bundled sqlite3 source instead of linking the system library (default false)") orelse false; | 43 | const use_bundled = b.option(bool, "use_bundled", "Use the bundled sqlite3 source instead of linking the system library (default false)") orelse false; |
| 42 | 44 | ||
| 45 | const target = getTarget(b.standardTargetOptions(.{}), use_bundled); | ||
| 46 | const mode = b.standardReleaseOptions(); | ||
| 47 | |||
| 43 | // Build sqlite from source if asked | 48 | // Build sqlite from source if asked |
| 44 | if (use_bundled) { | 49 | if (use_bundled) { |
| 45 | const lib = b.addStaticLibrary("sqlite", null); | 50 | const lib = b.addStaticLibrary("sqlite", null); |