forked from tbvdm/sigbak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
156119a
commit a053cd5
Showing
7 changed files
with
499 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.zig-cache | ||
.direnv | ||
|
||
*.[do] | ||
/*.pb-c.[ch] | ||
/sigbak | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.Build) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
const version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 0 }; | ||
|
||
var flags = std.BoundedArray([]const u8, 16){}; | ||
flags.appendSliceAssumeCapacity(&EXE_FLAGS); | ||
|
||
const protocc_run = b.addSystemCommand(&.{"protoc-c"}); | ||
protocc_run.addArgs(&.{"--c_out=."}); | ||
protocc_run.addArgs(&PROTO_SOURCES); | ||
|
||
const sigbak_exe = b.addExecutable(.{ | ||
.name = "sigbak", | ||
.target = target, | ||
.version = version, | ||
.optimize = optimize, | ||
}); | ||
sigbak_exe.addCSourceFiles(.{ | ||
.files = &EXE_SOURCES, | ||
.flags = flags.constSlice(), | ||
}); | ||
sigbak_exe.addCSourceFiles(.{ | ||
.files = &COMPAT_SOURCES, | ||
.flags = flags.constSlice(), | ||
}); | ||
sigbak_exe.addCSourceFiles(.{ | ||
.files = &PROTO_GENERATED_SOURCES, | ||
.flags = flags.constSlice(), | ||
}); | ||
sigbak_exe.linkSystemLibrary("libcrypto"); | ||
sigbak_exe.linkSystemLibrary("libprotobuf-c"); | ||
sigbak_exe.linkSystemLibrary("sqlite3"); | ||
sigbak_exe.linkLibC(); | ||
|
||
sigbak_exe.step.dependOn(&protocc_run.step); | ||
|
||
b.installArtifact(sigbak_exe); | ||
|
||
const run_cmd = b.addRunArtifact(sigbak_exe); | ||
|
||
run_cmd.step.dependOn(b.getInstallStep()); | ||
|
||
if (b.args) |args| { | ||
run_cmd.addArgs(args); | ||
} | ||
|
||
const run_step = b.step("run", "Run the app"); | ||
run_step.dependOn(&run_cmd.step); | ||
} | ||
|
||
const EXE_FLAGS = .{ | ||
"-I.", | ||
"-Icompat", | ||
}; | ||
|
||
const EXE_SOURCES = .{ | ||
"cmd-check-backup.c", | ||
"cmd-dump-backup.c", | ||
"cmd-export-attachments.c", | ||
"cmd-export-avatars.c", | ||
"cmd-export-database.c", | ||
"cmd-export-messages.c", | ||
"mime.c", | ||
"sbk-attachment-tree.c", | ||
"sbk-attachment.c", | ||
"sbk-database.c", | ||
"sbk-edit.c", | ||
"sbk-file.c", | ||
"sbk-frame.c", | ||
"sbk-mention.c", | ||
"sbk-message.c", | ||
"sbk-open.c", | ||
"sbk-quote.c", | ||
"sbk-reaction.c", | ||
"sbk-read.c", | ||
"sbk-recipient-tree.c", | ||
"sbk-recipient.c", | ||
"sbk-sqlite.c", | ||
"sbk-thread.c", | ||
"sigbak.c", | ||
}; | ||
|
||
const PROTO_SOURCES = .{ | ||
"backup.proto", | ||
"database.proto", | ||
}; | ||
|
||
const PROTO_GENERATED_SOURCES = .{ | ||
"backup.pb-c.c", | ||
"database.pb-c.c", | ||
}; | ||
|
||
const COMPAT_SOURCES = .{ | ||
"compat/asprintf.c", | ||
"compat/bs_cbb.c", | ||
"compat/err.c", | ||
"compat/explicit_bzero.c", | ||
"compat/fopen.c", | ||
"compat/getprogname.c", | ||
"compat/hkdf.c", | ||
"compat/hmac_ctx_new.c", | ||
"compat/pledge.c", | ||
"compat/readpassphrase.c", | ||
"compat/reallocarray.c", | ||
"compat/unveil.c", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.{ | ||
.name = "sigbak", | ||
.version = "0.1.0", | ||
.minimum_zig_version = "0.13.0", | ||
.dependencies = .{ | ||
.sigbak = .{ | ||
.url = "https://github.com/tbvdm/sigbak/archive/39cdd9199cbd59b0ac54f30352b800bf990a96c3.tar.gz", | ||
.hash = "12209c916f60bf396c4e2dda50993974ef3ac7b79a2c0fae0238b3f8dd84ecc70709", | ||
}, | ||
}, | ||
.paths = .{ | ||
"FailStep.zig", | ||
"build.zig", | ||
"build.zig.zon", | ||
"LICENSE", | ||
"README.md", | ||
}, | ||
} |
Oops, something went wrong.