jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / z / zigmod.rb
blob6bdf3a9f6715ef840215e4ea4dab465ce0157fd0
1 class Zigmod < Formula
2   desc "Package manager for the Zig programming language"
3   homepage "https://nektro.github.io/zigmod/"
4   url "https://github.com/nektro/zigmod/archive/refs/tags/r93.tar.gz"
5   sha256 "302162e6ba66ee8abe028b5d61fe1c474ec50eadfb6481dc782702126fddb639"
6   license "MIT"
8   livecheck do
9     url :stable
10     regex(/^r(\d+)$/i)
11   end
13   bottle do
14     sha256 cellar: :any_skip_relocation, arm64_sequoia: "420f7558e02cced834ae9109dfb12b93a864510c582af36d097cbb25a3379fc0"
15     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "3ada99291a14a4b050d9021469d4912be19098785d6d557ccfd09f7613dbce43"
16     sha256 cellar: :any_skip_relocation, arm64_ventura: "6dde24eaa99843a68b0f5c59f95c3a7116afd326b315d8a30f519cd6eb099c79"
17     sha256 cellar: :any_skip_relocation, sonoma:        "61702ca7b0671790b8598c55957f3cd53b6f215907be3add1f9de06f3da746ad"
18     sha256 cellar: :any_skip_relocation, ventura:       "dfd79a1b16483e86d85867b7494952d6a9c05dbc26c0924fd952106370e41500"
19     sha256 cellar: :any_skip_relocation, x86_64_linux:  "41a39652f9ed4f90a02280a3064bfa9a16746fda7af518d886280e86dceeb068"
20   end
22   depends_on "pkgconf" => :build
23   depends_on "zig"
25   def install
26     # Fix illegal instruction errors when using bottles on older CPUs.
27     # https://github.com/Homebrew/homebrew-core/issues/92282
28     cpu = case Hardware.oldest_cpu
29     when :arm_vortex_tempest then "apple_m1" # See `zig targets`.
30     else Hardware.oldest_cpu
31     end
33     args = %W[
34       --prefix #{prefix}
35       -Dtag=#{version}
36       -Dmode=ReleaseSafe
37       -Dstrip=true
38     ]
40     args << "-Dcpu=#{cpu}" if build.bottle?
42     system "zig", "build", *args
43   end
45   test do
46     (testpath/"zigmod.yml").write <<~YAML
47       id: 89ujp8gq842x6mzok8feypwze138n2d96zpugw44hcq7406r
48       name: zigmod
49       main: src/lib.zig
50       license: MIT
51       description: Test zig.mod
52       min_zig_version: 0.11.0
53       dependencies:
54         - src: git https://github.com/nektro/zig-yaml
55     YAML
57     (testpath/"src/lib.zig").write <<~ZIG
58       const std = @import("std");
59       pub fn main() !void {
60         std.log.info("Hello, world!");
61       }
62     ZIG
64     system bin/"zigmod", "fetch"
65     assert_path_exists testpath/"deps.zig"
66     assert_path_exists testpath/"zigmod.lock"
68     assert_match version.to_s, shell_output("#{bin}/zigmod version")
69   end
70 end