Skip to content

Commit e6377ed

Browse files
authored
Merge pull request #19945 from botantony/cabal
dev-cmd/create: add `--cabal` switch
2 parents 0cd1e6c + 6278ac1 commit e6377ed

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Library/Homebrew/dev-cmd/create.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class Create < AbstractCommand
2020
EOS
2121
switch "--autotools",
2222
description: "Create a basic template for an Autotools-style build."
23+
switch "--cabal",
24+
description: "Create a basic template for a Cabal build."
2325
switch "--cask",
2426
description: "Create a basic template for a cask."
2527
switch "--cmake",
@@ -59,7 +61,7 @@ class Create < AbstractCommand
5961
switch "-f", "--force",
6062
description: "Ignore errors for disallowed formula names and names that shadow aliases."
6163

62-
conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node",
64+
conflicts "--autotools", "--cabal", "--cmake", "--crystal", "--go", "--meson", "--node",
6365
"--perl", "--python", "--ruby", "--rust", "--zig", "--cask"
6466
conflicts "--cask", "--HEAD"
6567
conflicts "--cask", "--set-license"
@@ -163,6 +165,8 @@ def create_formula
163165
:crystal
164166
elsif args.go?
165167
:go
168+
elsif args.cabal?
169+
:cabal
166170
elsif args.meson?
167171
:meson
168172
elsif args.node?

Library/Homebrew/formula_creator.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ class #{Formulary.class_s(name)} < Formula
138138
head "#{@url}"
139139
<% end %>
140140
141-
<% if @mode == :cmake %>
141+
<% if @mode == :cabal %>
142+
depends_on "cabal-install" => :build
143+
depends_on "ghc" => :build
144+
<% elsif @mode == :cmake %>
142145
depends_on "cmake" => :build
143146
<% elsif @mode == :crystal %>
144147
depends_on "crystal" => :build
@@ -172,7 +175,10 @@ class #{Formulary.class_s(name)} < Formula
172175
173176
<% end %>
174177
def install
175-
<% if @mode == :cmake %>
178+
<% if @mode == :cabal %>
179+
system "cabal", "v2-update"
180+
system "cabal", "v2-install", *std_cabal_v2_args
181+
<% elsif @mode == :cmake %>
176182
system "cmake", "-S", ".", "-B", "build", *std_cmake_args
177183
system "cmake", "--build", "build"
178184
system "cmake", "--install", "build"

Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/create.rbi

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)