2023-08-12 19:27:20 +02:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
|
|
|
|
const lib = b.addSharedLibrary(.{
|
2024-01-24 19:40:50 +01:00
|
|
|
.name = "mzte-mpv",
|
2024-06-21 18:43:42 +02:00
|
|
|
.root_source_file = b.path("src/main.zig"),
|
2024-03-20 20:45:59 +01:00
|
|
|
.link_libc = true,
|
2023-08-12 19:27:20 +02:00
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2024-03-20 20:45:59 +01:00
|
|
|
lib.root_module.addImport("common", b.dependency("common", .{}).module("common"));
|
2023-08-12 19:27:20 +02:00
|
|
|
|
2024-04-02 23:07:04 +02:00
|
|
|
// Linking MPV for a plugin is usually undesirable, but it seems to work anyways.
|
|
|
|
// This is here because Zig will otherwise not find the necessary header files on NixOS,
|
|
|
|
// and there appears to be no way to obtain an include path using pkg-config without
|
|
|
|
// also linking.
|
|
|
|
lib.root_module.linkSystemLibrary("mpv", .{});
|
|
|
|
|
2023-08-12 19:27:20 +02:00
|
|
|
const install_step = b.addInstallArtifact(lib, .{
|
|
|
|
// this is not a standard MPV installation path, but instead one that makes sense.
|
|
|
|
// this requires a symlink ../../../.local/share/mpv/scripts => ~/.config/mpv/scripts
|
|
|
|
.dest_dir = .{ .override = .{ .custom = "share/mpv/scripts" } },
|
2024-01-24 19:40:50 +01:00
|
|
|
.dest_sub_path = "mzte-mpv.so",
|
2023-08-12 19:27:20 +02:00
|
|
|
});
|
|
|
|
b.getInstallStep().dependOn(&install_step.step);
|
|
|
|
}
|