diff options
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/create.rb | 134 |
1 files changed, 65 insertions, 69 deletions
diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index e5481b532..122be2593 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -165,77 +165,73 @@ class FormulaCreator path.write ERB.new(template, nil, ">").result(binding) end - def template; <<~EOS - # Documentation: https://docs.brew.sh/Formula-Cookbook.html - # http://www.rubydoc.info/github/Homebrew/brew/master/Formula - # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! - - class #{Formulary.class_s(name)} < Formula - desc "#{desc}" - homepage "#{homepage}" - <% if head? %> - head "#{url}" - <% else %> - url "#{url}" - <% unless version.nil? or version.detected_from_url? %> - version "#{version}" - <% end %> - sha256 "#{sha256}" - <% end %> - - <% if mode == :cmake %> - depends_on "cmake" => :build - <% elsif mode == :meson %> - depends_on "meson" => :build - depends_on "ninja" => :build - <% elsif mode.nil? %> - # depends_on "cmake" => :build - <% end %> - - def install - # ENV.deparallelize # if your formula fails when building in parallel - - <% if mode == :cmake %> - system "cmake", ".", *std_cmake_args - <% elsif mode == :autotools %> - # Remove unrecognized options if warned by configure - system "./configure", "--disable-debug", - "--disable-dependency-tracking", - "--disable-silent-rules", - "--prefix=\#{prefix}" - <% elsif mode == :meson %> - mkdir "build" do - system "meson", "--prefix=\#{prefix}", ".." - system "ninja" - system "ninja", "test" - system "ninja", "install" + def template + <<~EOS + # Documentation: https://docs.brew.sh/Formula-Cookbook.html + # http://www.rubydoc.info/github/Homebrew/brew/master/Formula + # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! + class #{Formulary.class_s(name)} < Formula + desc "#{desc}" + homepage "#{homepage}" + <% if head? %> + head "#{url}" + <% else %> + url "#{url}" + <% unless version.nil? or version.detected_from_url? %> + version "#{version}" + <% end %> + sha256 "#{sha256}" + <% end %> + <% if mode == :cmake %> + depends_on "cmake" => :build + <% elsif mode == :meson %> + depends_on "meson" => :build + depends_on "ninja" => :build + <% elsif mode.nil? %> + # depends_on "cmake" => :build + <% end %> + def install + # ENV.deparallelize # if your formula fails when building in parallel + <% if mode == :cmake %> + system "cmake", ".", *std_cmake_args + <% elsif mode == :autotools %> + # Remove unrecognized options if warned by configure + system "./configure", "--disable-debug", + "--disable-dependency-tracking", + "--disable-silent-rules", + "--prefix=\#{prefix}" + <% elsif mode == :meson %> + mkdir "build" do + system "meson", "--prefix=\#{prefix}", ".." + system "ninja" + system "ninja", "test" + system "ninja", "install" + end + <% else %> + # Remove unrecognized options if warned by configure + system "./configure", "--disable-debug", + "--disable-dependency-tracking", + "--disable-silent-rules", + "--prefix=\#{prefix}" + # system "cmake", ".", *std_cmake_args + <% end %> + <% if mode != :meson %> + system "make", "install" # if this fails, try separate make/make install steps + <% end %> + end + test do + # `test do` will create, run in and delete a temporary directory. + # + # This test will fail and we won't accept that! For Homebrew/homebrew-core + # this will need to be a test that verifies the functionality of the + # software. Run the test with `brew test #{name}`. Options passed + # to `brew install` such as `--HEAD` also need to be provided to `brew test`. + # + # The installed folder is not in the path, so use the entire path to any + # executables being tested: `system "\#{bin}/program", "do", "something"`. + system "false" end - <% else %> - # Remove unrecognized options if warned by configure - system "./configure", "--disable-debug", - "--disable-dependency-tracking", - "--disable-silent-rules", - "--prefix=\#{prefix}" - # system "cmake", ".", *std_cmake_args - <% end %> - <% if mode != :meson %> - system "make", "install" # if this fails, try separate make/make install steps - <% end %> - end - - test do - # `test do` will create, run in and delete a temporary directory. - # - # This test will fail and we won't accept that! For Homebrew/homebrew-core - # this will need to be a test that verifies the functionality of the - # software. Run the test with `brew test #{name}`. Options passed - # to `brew install` such as `--HEAD` also need to be provided to `brew test`. - # - # The installed folder is not in the path, so use the entire path to any - # executables being tested: `system "\#{bin}/program", "do", "something"`. - system "false" end - end EOS end end |
