New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zig 0.1.1 (new formula) #23189
zig 0.1.1 (new formula) #23189
Conversation
Formula/zig.rb
Outdated
|
||
def install | ||
Dir.mkdir "build" | ||
Dir.chdir "build" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a single line: mkdir "build" do
Formula/zig.rb
Outdated
def install | ||
Dir.mkdir "build" | ||
Dir.chdir "build" do | ||
system "cmake", "..", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you can simply say: system "cmake", "..", *std_cmake_args
which should take care of the paths for you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get Error: Empty installation
when I use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std_cmake_args
contains:
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-Wno-dev
But I do not understand what your CMAKE_PREFIX_PATH
is pointing to. #{prefix}
will expand to zig
's own prefix (e.g. /usr/local/Cellar/zig/0.1.1
), so why are you appending llvm@5
to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually maybe I'm calling mkdir
strangely, let me test a bit.
edit: I was. Was trying to call Dir.mkdir
instead of mkdir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was naively following zig's build instructions to see how everything worked. std_cmake_args
works great though!
Formula/zig.rb
Outdated
end | ||
|
||
test do | ||
src = <<-HEREDOC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer the following syntax: (testpath/"hello.zip").write <<~EOS
Formula/zig.rb
Outdated
HEREDOC | ||
File.write("hello.zig", src) | ||
system "#{bin}/zig", "build-exe", "hello.zig" | ||
system "./hello" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check that the output from hello
is as expected?
assert_equal "Hello, world!\n", shell_output("./hello")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's much better thanks.
Formula/zig.rb
Outdated
end | ||
|
||
test do | ||
(testpath/"hello.zig").write <<~HEREDOC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll prefer EOS
to HEREDOC
, for consistency with other formulas.
And can the empty lines in hello.zig
be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding |
Thanks for the reviews. I am curious as to whether |
also the test is still failing with just Failing with same error as
|
That remaining audit failure we'll ignore, as it has a valid reason to use Homebrew LLVM. |
Formula/zig.rb
Outdated
sha256 "a160d14aecebead2f8c574b0dd687cdfecc53d149d521a17b89b629d8b558c94" | ||
|
||
depends_on "cmake" => :build | ||
depends_on "llvm" => :build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zig links to LLVM's libc++ (/usr/local/opt/llvm/lib/libc++.1.dylib
). So this dependency is necessary at runtime too. Remove the => :build
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for sussing that out!
@fxcoudert thanks a lot for a painless contributor experience and for the prompt reviews! I'll look forward to seeing this land. I'll do some research around what fleshing out this formula might look like (see associated |
hi @jfo why did you close this? |
@fxcoudert sorry, I was pushing https://github.com/jfo/homebrew-core/commit/35218e954e19d44d2b6b35f8d221dc15a64425ad from a local branch and typed |
I pushed my changes back to my fork's master but github is confused now. edit: looks like reopening it triggered a recheck, sorry for the noise!! :) |
Formula/zig.rb
Outdated
|
||
def install | ||
mkdir "build" do | ||
system "cmake", "..", *std_cmake_args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this an in-tree build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean
diff --git a/Formula/zig.rb b/Formula/zig.rb
index 42ce4f54..758d9617 100644
--- a/Formula/zig.rb
+++ b/Formula/zig.rb
@@ -8,10 +8,8 @@ class Zig < Formula
depends_on "llvm"
def install
- mkdir "build" do
- system "cmake", "..", *std_cmake_args
- system "make", "install"
- end
+ system "cmake", ".", *std_cmake_args
+ system "make", "install"
end
test do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya
@jfo thanks for your contribution to Homebrew! |
@BrewTestBot test this please |
@jfo sorry, somehow the |
And… finally, it's in! Thanks again @jfo |
🙌 thank you! Super great and much appreciated. |
HI! Thanks for
brew
.I'd like to add zig's 0.1.1 release to brew. I do need feedback on a dependency issue, though.
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?See: ziglang/zig#714 (comment)
Please lmkwyt! Thank you.
This PR resolves ziglang/zig#714