From 2cbc6ec1a485e7e4d7444025984cfe562f2ff682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Tue, 13 Aug 2024 07:13:32 +0200 Subject: [PATCH] Various small fixes (#483) Allows our project to build with the upgraded zigler --- lib/zig/_c.ex | 5 +---- lib/zig/templates/build.zig.eex | 2 +- mix.exs | 8 +++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/zig/_c.ex b/lib/zig/_c.ex index c42cea08..f1db12aa 100644 --- a/lib/zig/_c.ex +++ b/lib/zig/_c.ex @@ -51,10 +51,7 @@ defmodule Zig.C do defp solve_relative({:system, _} = system, _), do: system defp solve_relative(file, module_file) do - module_file - |> Path.dirname() - |> Path.join(file) - |> Path.expand() + Path.expand(file, module_file) end defp normalize_src(file, module_file) when is_binary(file) do diff --git a/lib/zig/templates/build.zig.eex b/lib/zig/templates/build.zig.eex index 45bc30f9..33ea2a98 100644 --- a/lib/zig/templates/build.zig.eex +++ b/lib/zig/templates/build.zig.eex @@ -74,7 +74,7 @@ pub fn build(b: *std.Build) void { <% {:system, lib} -> %> nif.linkSystemLibrary("<%= lib %>", .{}); <% lib -> %> - nif.addObjectFile("<%= lib %>"); + nif.addObjectFile(.{.cwd_relative = "<%= lib %>"}); <% end %> <% end %> <% end %> diff --git a/mix.exs b/mix.exs index a44e5d39..82194fc3 100644 --- a/mix.exs +++ b/mix.exs @@ -46,11 +46,9 @@ defmodule Zigler.MixProject do end defp guides() do - "guides" - |> File.ls!() - |> Enum.sort() - |> Enum.filter(&String.ends_with?(&1, ".md")) - |> Enum.map(&Path.join("guides", &1)) + "guides/*.md" + |> Path.wildcard() + |> Enum.map(&Path.join("guides", Path.basename(&1, ".md"))) end def application, do: [extra_applications: [:logger, :inets, :crypto, :public_key, :ssl]]