dev-cmd/create: add --cabal switch

Signed-off-by: botantony <antonsm21@gmail.com>
This commit is contained in:
botantony 2025-05-14 11:12:25 +02:00
parent 69667974bc
commit 92832c258c
No known key found for this signature in database
GPG Key ID: 7FE721557EA6AAD6
3 changed files with 16 additions and 3 deletions

View File

@ -20,6 +20,8 @@ module Homebrew
EOS EOS
switch "--autotools", switch "--autotools",
description: "Create a basic template for an Autotools-style build." description: "Create a basic template for an Autotools-style build."
switch "--cabal",
description: "Create a basic template for a Cabal build."
switch "--cask", switch "--cask",
description: "Create a basic template for a cask." description: "Create a basic template for a cask."
switch "--cmake", switch "--cmake",
@ -59,7 +61,7 @@ module Homebrew
switch "-f", "--force", switch "-f", "--force",
description: "Ignore errors for disallowed formula names and names that shadow aliases." description: "Ignore errors for disallowed formula names and names that shadow aliases."
conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node", conflicts "--autotools", "--cabal", "--cmake", "--crystal", "--go", "--meson", "--node",
"--perl", "--python", "--ruby", "--rust", "--zig", "--cask" "--perl", "--python", "--ruby", "--rust", "--zig", "--cask"
conflicts "--cask", "--HEAD" conflicts "--cask", "--HEAD"
conflicts "--cask", "--set-license" conflicts "--cask", "--set-license"
@ -163,6 +165,8 @@ module Homebrew
:crystal :crystal
elsif args.go? elsif args.go?
:go :go
elsif args.cabal?
:cabal
elsif args.meson? elsif args.meson?
:meson :meson
elsif args.node? elsif args.node?

View File

@ -138,7 +138,10 @@ module Homebrew
head "#{@url}" head "#{@url}"
<% end %> <% end %>
<% if @mode == :cmake %> <% if @mode == :cabal %>
depends_on "cabal-install" => :build
depends_on "ghc" => :build
<% elsif @mode == :cmake %>
depends_on "cmake" => :build depends_on "cmake" => :build
<% elsif @mode == :crystal %> <% elsif @mode == :crystal %>
depends_on "crystal" => :build depends_on "crystal" => :build
@ -172,7 +175,10 @@ module Homebrew
<% end %> <% end %>
def install def install
<% if @mode == :cmake %> <% if @mode == :cabal %>
system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
<% elsif @mode == :cmake %>
system "cmake", "-S", ".", "-B", "build", *std_cmake_args system "cmake", "-S", ".", "-B", "build", *std_cmake_args
system "cmake", "--build", "build" system "cmake", "--build", "build"
system "cmake", "--install", "build" system "cmake", "--install", "build"

View File

@ -17,6 +17,9 @@ class Homebrew::DevCmd::Create::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def autotools?; end def autotools?; end
sig { returns(T::Boolean) }
def cabal?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def cask?; end def cask?; end