brew

https://github.com/homebrew/brew

Ruby

🍺 The missing package manager for macOS

Formula.patch

External patches can be declared using resource-style blocks.
<pre>patch do
  url "https://example.com/example_patch.diff"
  sha256 "c6bc3f48ce8e797854c4b865f6a8ff969867bbcaebd648ae6fd825683e59fef2"
end</pre>

A strip level of `-p1` is assumed. It can be overridden using a symbol
argument:
<pre>patch :p0 do
  url "https://example.com/example_patch.diff"
  sha256 "c6bc3f48ce8e797854c4b865f6a8ff969867bbcaebd648ae6fd825683e59fef2"
end</pre>

Patches can be declared in stable, devel, and head blocks. This form is
preferred over using conditionals.
<pre>stable do
  patch do
    url "https://example.com/example_patch.diff"
    sha256 "c6bc3f48ce8e797854c4b865f6a8ff969867bbcaebd648ae6fd825683e59fef2"
  end
end</pre>

Embedded (`__END__`) patches are declared like so:
<pre>patch :DATA
patch :p0, :DATA</pre>

Patches can also be embedded by passing a string. This makes it possible
to provide multiple embedded patches while making only some of them
conditional.
<pre>patch :p0, "..."</pre>

Source | Google | Stack overflow

Edit

git clone [email protected]:homebrew/brew.git

cd brew

open Library/Homebrew/formula.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Formula-patch-for-pr


# Commit to git

git add Library/Homebrew/formula.rbgit commit -m "better docs for Formula.patch"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Formula-patch-for-pr

hub pull-request


# Celebrate!