Compare commits

...

2 Commits

Author SHA1 Message Date
2a4b73c0f5
build: update for zig-0.12.0-dev.2208+4debd4338 2024-01-15 16:54:51 -08:00
4b9dbeea65
Add license
This is the same license as cmark (2-clause BSD).
2024-01-15 16:54:30 -08:00
4 changed files with 46 additions and 6 deletions

View File

@ -9,8 +9,9 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const cmark = b.addModule("cmark", .{
.source_file = .{ .path = "src/cmark.zig" },
.root_source_file = .{ .path = "src/cmark.zig" },
});
cmark.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
const cmark_c = cmark_build.cmark_lib(b, .{
.name = "cmark-c",
@ -26,7 +27,7 @@ pub fn build(b: *std.Build) void {
}
const ExampleOptions = struct {
target: std.zig.CrossTarget,
target: std.Build.ResolvedTarget,
cmark_module: *std.Build.Module,
cmark_c: *std.Build.Step.Compile,
};
@ -40,7 +41,7 @@ const examples = [_]Example{
.{ .name = "render_html", .file = "examples/render_html.zig" },
};
pub fn add_examples(b: *std.build, options: ExampleOptions) void {
pub fn add_examples(b: *std.Build, options: ExampleOptions) void {
const example_step = b.step("examples", "build examples");
inline for (examples) |example| {
@ -51,7 +52,7 @@ pub fn add_examples(b: *std.build, options: ExampleOptions) void {
.optimize = .Debug,
});
ex_exe.addModule("cmark", options.cmark_module);
ex_exe.root_module.addImport("cmark", options.cmark_module);
ex_exe.linkLibrary(options.cmark_c);
const install = b.addInstallArtifact(ex_exe, .{});

13
build.zig.zon Normal file
View File

@ -0,0 +1,13 @@
.{
.name = "cmark-zig",
.version = "0.1.0-pre",
.dependencies = .{},
.paths = .{
"src",
"deps/cmark/src",
"deps/cmark/COPYING",
"build.zig",
"build.zig.zon",
"license",
},
}

View File

@ -5,7 +5,7 @@ const std = @import("std");
const CmarkBuildOptions = struct {
name: []const u8 = "cmark-c",
target: std.zig.CrossTarget,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
};
@ -22,7 +22,7 @@ pub fn cmark_lib(
const cflags = [_][]const u8{};
lib.linkLibC();
lib.addCSourceFiles(&common_sources, &cflags);
lib.addCSourceFiles(.{ .files = &common_sources, .flags = &cflags });
lib.addIncludePath(.{ .path = cmark_src_prefix ++ "include" });
const config_h = b.addConfigHeader(.{

26
license Normal file
View File

@ -0,0 +1,26 @@
Copyright (c) 2024, torque@epicyclic.dev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.