From b4c56937b196f703c3c989f8b4271101a3adbd61 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Wed, 25 Sep 2019 14:29:09 +0200 Subject: [PATCH] create: add --rust option --- Library/Homebrew/dev-cmd/create.rb | 6 +++++- Library/Homebrew/formula_creator.rb | 4 ++++ docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 8ee6974c93..12644070fd 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -29,6 +29,8 @@ module Homebrew description: "Create a basic template for a Meson-style build." switch "--python", description: "Create a basic template for a Python build." + switch "--rust", + description: "Create a basic template for a Rust build." switch "--no-fetch", description: "Homebrew will not download to the cache and will thus not add its SHA-256 "\ "to the formula for you, nor will it check the GitHub API for GitHub projects "\ @@ -44,7 +46,7 @@ module Homebrew switch :force switch :verbose switch :debug - conflicts "--autotools", "--cmake", "--go", "--meson", "--python" + conflicts "--autotools", "--cmake", "--go", "--meson", "--python", "--rust" end end @@ -81,6 +83,8 @@ module Homebrew :go elsif args.python? :python + elsif args.rust? + :rust end if fc.name.nil? || fc.name.strip.empty? diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index eeb4fdd693..b87b280d10 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -110,6 +110,8 @@ module Homebrew depends_on "ninja" => :build <% elsif mode == :python %> depends_on "python" + <% elsif mode == :rust %> + depends_on "rust" => :build <% elsif mode.nil? %> # depends_on "cmake" => :build <% end %> @@ -142,6 +144,8 @@ module Homebrew end <% elsif mode == :python %> virtualenv_install_with_resources + <% elsif mode == :rust %> + system "cargo", "install", "--root", prefix, "--path", "." <% else %> # Remove unrecognized options if warned by configure system "./configure", "--disable-debug", diff --git a/docs/Manpage.md b/docs/Manpage.md index 3e459b91c1..14be219439 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -807,6 +807,8 @@ a simple example. For the complete API, see: Create a basic template for a Meson-style build. * `--python`: Create a basic template for a Python build. +* `--rust`: + Create a basic template for a Rust build. * `--no-fetch`: Homebrew will not download *`URL`* to the cache and will thus not add its SHA-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage). * `--HEAD`: diff --git a/manpages/brew.1 b/manpages/brew.1 index fd6436469f..8ba008578a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1032,6 +1032,10 @@ Create a basic template for a Meson\-style build\. Create a basic template for a Python build\. . .TP +\fB\-\-rust\fR +Create a basic template for a Rust build\. +. +.TP \fB\-\-no\-fetch\fR Homebrew will not download \fIURL\fR to the cache and will thus not add its SHA\-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage)\. .