1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 18:18:51 +03:00
mal/impls/zig/build.zig
Nicolas Boulenguez 8c7d495eea zig: build with 0.13.0, merge eval_ast, fix remaining issues
Update build system, syntax and library calls for zig 0.13.0.

Rewrite the build system so that the steps can build separately.  Drop
intermediate symbolic links (unneeded complexity, confusing
timestamps).

Build with debugging options, this is a toy project full of memory
leaks.

Declare the allocators as global variables instead of passing and/or
storing always the same reference everywhere for no benefit.

Make apply_function a global variable instead of adding a reference to
EVAL in each function.

Pass arguments as a slice instead of using a different type for each
argument count.

There is no point in renaming default errors.

Remove a lot of reference counting and some indirection levels.
This fixes the current segmentation faults.

Create each object as soon as possible and use errdefer so that it is
deallocated if an exception occurs when computing its elemements.

Use a global variable to convey a MAL object alongside a thrown error.

Remove the unused logging_alloc module (but add a debug_alloc boolean
in types.zig).
2024-09-19 14:48:19 -04:00

27 lines
761 B
Zig

const Builder = @import("std").Build;
pub fn build(b: *Builder) void {
// Two options select the built step.
const name = b.option([]const u8, "name", "step name (without .zig)")
orelse "stepA_mal";
const root_source_file = b.path(
b.option([]const u8, "root_source_file", "step name (with .zig)")
orelse "stepA_mal.zig");
const exe = b.addExecutable(.{
.name = name,
.root_source_file = root_source_file,
.target = b.standardTargetOptions(.{}),
.optimize = b.standardOptimizeOption(.{}),
});
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("pcre");
exe.linkSystemLibrary("readline");
b.default_step.dependOn(&exe.step);
b.installArtifact(exe);
}