docs: mention standard argument methods

This commit is contained in:
Eric Knibbe 2023-12-22 21:44:42 -05:00
parent 8537849f83
commit 09b7a7bceb
No known key found for this signature in database
GPG Key ID: 179D9CDDDB814168

View File

@ -435,6 +435,17 @@ if build.head?
end
```
### Standard arguments
For any formula using a well-known build system, there'll be arguments that should be passed during compilation such that its build conforms to Homebrew standards. These have been collected into a set of `std_*_args` methods (like [`std_configure_args`](https://rubydoc.brew.sh/Formula#std_configure_args-instance_method) and [`std_cmake_args`](https://rubydoc.brew.sh/Formula#std_cmake_args-instance_method) as seen in the [output of `brew create`](#grab-the-url)) that set the build type and installation paths, plus any other applicable options.
Most of these methods accept parameters to customize their output. For example, to set the install prefix to [**`libexec`**](#variables-for-directory-locations) for `configure` or `cmake`:
```ruby
system "./configure", *std_configure_args(prefix: libexec)
system "cmake", "-S", ".", "-B", "build", *std_cmake_args(install_prefix: libexec)
```
### `bin.install "foo"`
Youll see stuff like this in some formulae. This moves the file `foo` into the formulas `bin` directory (`/usr/local/Cellar/pkg/0.1/bin`) and makes it executable (`chmod 0555 foo`).