Merge pull request #6475 from dawidd6/create-go-mod

create: add --go-mod option
This commit is contained in:
Mike McQuaid 2019-09-24 16:44:51 +01:00 committed by GitHub
commit 28fc268060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View File

@ -23,6 +23,8 @@ module Homebrew
description: "Create a basic template for an Autotools-style build."
switch "--cmake",
description: "Create a basic template for a CMake-style build."
switch "--go",
description: "Create a basic template for a Go build."
switch "--meson",
description: "Create a basic template for a Meson-style build."
switch "--no-fetch",
@ -40,7 +42,7 @@ module Homebrew
switch :force
switch :verbose
switch :debug
conflicts "--autotools", "--cmake", "--meson"
conflicts "--autotools", "--cmake", "--go", "--meson"
end
end
@ -73,6 +75,8 @@ module Homebrew
:autotools
elsif args.meson?
:meson
elsif args.go?
:go
end
if fc.name.nil? || fc.name.strip.empty?

View File

@ -99,6 +99,8 @@ module Homebrew
<% if mode == :cmake %>
depends_on "cmake" => :build
<% elsif mode == :go %>
depends_on "go" => :build
<% elsif mode == :meson %>
depends_on "meson" => :build
depends_on "ninja" => :build
@ -116,6 +118,8 @@ module Homebrew
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=\#{prefix}"
<% elsif mode == :go %>
system "go", "build", "-o", "\#{bin}/\#{name}"
<% elsif mode == :meson %>
mkdir "build" do
system "meson", "--prefix=\#{prefix}", ".."
@ -130,7 +134,7 @@ module Homebrew
"--prefix=\#{prefix}"
# system "cmake", ".", *std_cmake_args
<% end %>
<% if mode != :meson %>
<% if mode != :meson and mode != :go %>
system "make", "install" # if this fails, try separate make/make install steps
<% end %>
end

View File

@ -801,6 +801,8 @@ a simple example. For the complete API, see:
Create a basic template for an Autotools-style build.
* `--cmake`:
Create a basic template for a CMake-style build.
* `--go`:
Create a basic template for a Go build.
* `--meson`:
Create a basic template for a Meson-style build.
* `--no-fetch`:

View File

@ -1020,6 +1020,10 @@ Create a basic template for an Autotools\-style build\.
Create a basic template for a CMake\-style build\.
.
.TP
\fB\-\-go\fR
Create a basic template for a Go build\.
.
.TP
\fB\-\-meson\fR
Create a basic template for a Meson\-style build\.
.