Add build.zig file

This commit is contained in:
Frank Denis 2021-10-08 15:04:21 +02:00
parent f6965a0858
commit 52ccad8685
3 changed files with 29 additions and 5 deletions

View file

@ -16,11 +16,22 @@ public key:
Compilation / installation
--------------------------
## Using [Zig](https://ziglang.org):
Dependencies:
* [libsodium](https://libsodium.org/)
Compilation:
$ zig build -Drelease-small
## Using cmake and gcc or clang:
* [libsodium](https://libsodium.org/)
* cmake
* pkg-config
* gcc or clang
Compilation:
@ -50,10 +61,6 @@ Minisign is also available in chocolatey on Windows:
$ choco install minisign
Minisign is also available on Ubuntu as a PPA:
$ [sudo] add-apt-repository ppa:dysfunctionalprogramming/minisign
Minisign is also available with docker:
$ docker run -i --rm jedisct1/minisign

17
build.zig Normal file
View file

@ -0,0 +1,17 @@
const std = @import("std");
pub fn build(b: *std.build.Builder) !void {
var target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const minisign = b.addExecutable("minisign", null);
minisign.setTarget(target);
minisign.setBuildMode(mode);
minisign.install();
minisign.linkLibC();
minisign.linkSystemLibrary("sodium");
minisign.addIncludeDir("src");
minisign.addSystemIncludeDir("/usr/local/include");
minisign.addCSourceFiles(&.{ "src/base64.c", "src/get_line.c", "src/helpers.c", "src/minisign.c" }, &.{});
}

View file

@ -1,6 +1,5 @@
#include <assert.h>
#include <getopt.h>
#include <inttypes.h>
#include <limits.h>
#include <stddef.h>
@ -10,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sodium.h>