mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-14 19:13:41 +01:00
rename mzte-nv
This commit is contained in:
parent
356fd16258
commit
7900d2925e
10 changed files with 64 additions and 30 deletions
|
@ -1,9 +1,9 @@
|
||||||
-- This module is responsible for loading the native mzte_nv lua module
|
-- This module is responsible for loading the native mzte-nv lua module
|
||||||
package.cpath = package.cpath .. ";" .. vim.loop.os_homedir() .. "/.local/share/nvim/mzte_nv.so"
|
package.cpath = package.cpath .. ";" .. vim.loop.os_homedir() .. "/.local/share/nvim/mzte-nv.so"
|
||||||
|
|
||||||
local success = pcall(require, "mzte_nv");
|
local success = pcall(require, "mzte_nv");
|
||||||
if not success then
|
if not success then
|
||||||
error "Failed to preload mzte_nv. Is it installed?"
|
error "Failed to preload mzte-nv. Is it installed?"
|
||||||
end
|
end
|
||||||
|
|
||||||
require("mzte_nv").onInit()
|
require("mzte_nv").onInit()
|
||||||
|
|
3
justfile
3
justfile
|
@ -36,5 +36,4 @@ install-lsps-paru:
|
||||||
|
|
||||||
|
|
||||||
install-mzte-nv:
|
install-mzte-nv:
|
||||||
cd mzte_nv && zig build -Drelease-fast
|
cd mzte-nv && zig build -Drelease-fast -p ~/.local
|
||||||
cp mzte_nv/zig-out/lib/libmzte_nv.so ~/.local/share/nvim/mzte_nv.so
|
|
||||||
|
|
0
mzte_nv/.gitignore → mzte-nv/.gitignore
vendored
0
mzte_nv/.gitignore → mzte-nv/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
# mzte_nv
|
# mzte-nv
|
||||||
|
|
||||||
Native components of my neovim config, implemented as a native LuaJIT module.
|
Native components of my neovim config, implemented as a native LuaJIT module.
|
59
mzte-nv/build.zig
Normal file
59
mzte-nv/build.zig
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
pub fn build(b: *std.build.Builder) !void {
|
||||||
|
if (@import("builtin").os.tag == .windows)
|
||||||
|
@compileError("no lol");
|
||||||
|
// Standard release options allow the person running `zig build` to select
|
||||||
|
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||||
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
|
const lib = b.addSharedLibrary("mzte-nv", "src/main.zig", .unversioned);
|
||||||
|
lib.setBuildMode(mode);
|
||||||
|
|
||||||
|
lib.linkLibC();
|
||||||
|
lib.linkSystemLibrary("luajit");
|
||||||
|
|
||||||
|
lib.strip = mode != .Debug;
|
||||||
|
lib.unwind_tables = true;
|
||||||
|
|
||||||
|
b.getInstallStep().dependOn(&(try InstallStep.init(b, lib)).step);
|
||||||
|
}
|
||||||
|
|
||||||
|
const InstallStep = struct {
|
||||||
|
builder: *std.build.Builder,
|
||||||
|
step: std.build.Step,
|
||||||
|
lib: *std.build.LibExeObjStep,
|
||||||
|
|
||||||
|
fn init(builder: *std.build.Builder, lib: *std.build.LibExeObjStep) !*InstallStep {
|
||||||
|
const self = try builder.allocator.create(InstallStep);
|
||||||
|
self.* = .{
|
||||||
|
.builder = builder,
|
||||||
|
.lib = lib,
|
||||||
|
.step = std.build.Step.init(.custom, "install", builder.allocator, make),
|
||||||
|
};
|
||||||
|
self.step.dependOn(&lib.step);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make(step: *std.build.Step) anyerror!void {
|
||||||
|
const self = @fieldParentPtr(InstallStep, "step", step);
|
||||||
|
|
||||||
|
const plugin_install_dir = std.build.InstallDir{
|
||||||
|
.custom = "share/nvim",
|
||||||
|
};
|
||||||
|
const plugin_basename = "mzte-nv.so";
|
||||||
|
|
||||||
|
const dest_path = self.builder.getInstallPath(
|
||||||
|
plugin_install_dir,
|
||||||
|
plugin_basename,
|
||||||
|
);
|
||||||
|
|
||||||
|
try self.builder.updateFile(
|
||||||
|
self.lib.getOutputSource().getPath(self.builder),
|
||||||
|
dest_path,
|
||||||
|
);
|
||||||
|
|
||||||
|
// FIXME: the uninstall step doesn't do anything, despite this
|
||||||
|
self.builder.pushInstalledFile(plugin_install_dir, plugin_basename);
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,24 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
|
||||||
// Standard release options allow the person running `zig build` to select
|
|
||||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
|
||||||
const mode = b.standardReleaseOptions();
|
|
||||||
|
|
||||||
const lib = b.addSharedLibrary("mzte_nv", "src/main.zig", .unversioned);
|
|
||||||
lib.setBuildMode(mode);
|
|
||||||
|
|
||||||
lib.linkLibC();
|
|
||||||
lib.linkSystemLibrary("luajit");
|
|
||||||
|
|
||||||
lib.strip = mode != .Debug;
|
|
||||||
lib.unwind_tables = true;
|
|
||||||
|
|
||||||
lib.install();
|
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
|
||||||
test_step.dependOn(&main_tests.step);
|
|
||||||
}
|
|
Loading…
Reference in a new issue