const std = @import("std");

pub fn create(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step.Compile {
    const lib = b.addStaticLibrary(.{
        .name = "houdini",
        .target = target,
        .optimize = optimize,
    });

    lib.linkLibC();

    const houdini_dep = b.dependency("houdini", .{
        .target = target,
        .optimize = optimize,
    });

    lib.addIncludePath(houdini_dep.path(""));
    lib.addCSourceFiles(.{
        .root = houdini_dep.path(""),
        .files = srcs,
        .flags = &.{},
    });

    lib.installHeader(houdini_dep.path("houdini.h"), "houdini.h");
    lib.installHeader(houdini_dep.path("buffer.h"), "buffer.h");

    return lib;
}

const srcs = &.{
    "buffer.c",
    "houdini_href_e.c",
    "houdini_html_e.c",
    "houdini_html_u.c",
    "houdini_js_e.c",
    "houdini_js_u.c",
    "houdini_uri_e.c",
    "houdini_uri_u.c",
    "houdini_xml_e.c",
};
