Skip to content

zig 0.1.1 (new formula) - #23189

Closed
jfo wants to merge 1 commit into
Homebrew:masterfrom
jfo:master
Closed

zig 0.1.1 (new formula)#23189
jfo wants to merge 1 commit into
Homebrew:masterfrom
jfo:master

Conversation

@jfo

@jfo jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor

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.

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

~ $ brew audit --strict zig
zig:
  * Dependency 'llvm@5' is an alias; use the canonical name 'llvm'.
Error: 1 problem in 1 formula

See: ziglang/zig#714 (comment)

Please lmkwyt! Thank you.

This PR resolves ziglang/zig#714

@fxcoudert fxcoudert added the new formula PR adds a new formula to Homebrew/homebrew-core label Jan 23, 2018
@jfo jfo mentioned this pull request Jan 23, 2018
Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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

Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

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?

@jfo jfo Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

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!

Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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

Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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")

Copy link
Copy Markdown
Contributor Author

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.

Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fxcoudert

Copy link
Copy Markdown
Member

Regarding llvm@5, our policy is to depend on llvm: when version 6 is published, hopefully there will be a new zig version to match it. Otherwise, if there is incompatibility, we will then modify the formula to depend on llvm@5.

@fxcoudert fxcoudert added the almost there PR is nearly ready to merge label Jan 23, 2018
@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews.

I am curious as to whether llvm is a build time dependency only. I'm waiting on an answer to that just so I'm sure. If it's necessary to have it during runtime, is it as simple as removing the :build symbol?

@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

also the test is still failing with just llvm, despite passing brew audit --strict zig

Failing with same error as brew audit --new-formula zig does locally:

zig:
  * Dependency 'llvm' may be unnecessary as it is provided by macOS; try to build this formula without it.
Error: 1 problem in 1 formula

@fxcoudert fxcoudert added ready to merge PR can be merged once CI is green and removed almost there PR is nearly ready to merge labels Jan 23, 2018
@fxcoudert

Copy link
Copy Markdown
Member

That remaining audit failure we'll ignore, as it has a valid reason to use Homebrew LLVM.

Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

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 fxcoudert removed the ready to merge PR can be merged once CI is green label Jan 23, 2018
@fxcoudert fxcoudert added the ready to merge PR can be merged once CI is green label Jan 23, 2018
@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

@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 man issue) and whether or not that is necessary at all. At the very least we'll keep it bumped on new releases.

@jfo jfo closed this Jan 23, 2018
@fxcoudert

Copy link
Copy Markdown
Member

hi @jfo why did you close this?

@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

@fxcoudert sorry, I was pushing https://github.com/jfo/homebrew-core/commit/35218e954e19d44d2b6b35f8d221dc15a64425ad from a local branch and typed git push myremote master instead of git push myremote mybranch:master

@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

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!! :)

@jfo jfo reopened this Jan 23, 2018
Comment thread Formula/zig.rb Outdated

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya

@fxcoudert

Copy link
Copy Markdown
Member

@jfo thanks for your contribution to Homebrew!

@fxcoudert

Copy link
Copy Markdown
Member

@BrewTestBot test this please

@fxcoudert

Copy link
Copy Markdown
Member

@jfo sorry, somehow the <<-EOS.undent in one of the commits is making our build bot fail. Could you squash the 3 commits together into a single commit please? Then I can merge this.

@fxcoudert

Copy link
Copy Markdown
Member

And… finally, it's in! Thanks again @jfo

@fxcoudert fxcoudert closed this in c33c622 Jan 23, 2018
@jfo

jfo commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

🙌 thank you!

Super great and much appreciated.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

new formula PR adds a new formula to Homebrew/homebrew-core ready to merge PR can be merged once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 0.1.1 to homebrew

3 participants