Skip to content

Commit

Permalink
CONTRIBUTING.md: add bottles, revision notes
Browse files Browse the repository at this point in the history
Misc minor edits.
  • Loading branch information
ianml committed May 7, 2015
1 parent 36ea81d commit 9b293e5
Showing 1 changed file with 43 additions and 22 deletions.
65 changes: 43 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
# Contributing
Thank you for your interest in contributing to [Homebrew/science]. The following guidelines are designed to help you write more efficient pull requests.

Thank you for your interest in contributing to [Homebrew Science]. The following guidelines are designed to help you write more efficient pull requests.

## Formula Guidelines
Read Homebrew's [Formula Cookbook] and [Acceptable Formulae]. If your formula installs or depends on Python modules you may want to read [Python for Formula Authors] as well.

Please **follow the [GitHub Ruby Styleguide]**.
**IMPORTANT** First read Homebrew's [Formula Cookbook] and [Acceptable Formulae]. If your formula installs or depends on Python modules read [Python for Formula Authors] as well.

Homebrew follows the [GitHub Ruby Styleguide]. Check `brew style` or `brew audit --strict` before submitting a new formula.

#### Patches
Homebrew provides DSL for applying diff patches appended to the end of formula file, or as remote files (e.g. a gist). In most cases, patches should be submitted upstream and linked to in your comments.

Homebrew provides DSL for applying diff patches appended to the end of formula file, or as remote files (e.g. a [Gist]). In most cases, patches should be submitted upstream and linked to in your comments.

#### Tests
All formulæ should be accompanied by tests. We greatly appreciate any submissions that improve individual tests and test coverage in Homebrew/science.

All formulæ should be accompanied by tests. We greatly appreciate any submissions that improve individual tests and test coverage in Homebrew Science.

The `test do` block allows for a post-build test of software functionality sandboxed within a temporary `testpath`. For example, a test program may be written and compiled, and its output checked against an expected value. Meaningful tests are preferred over simple commands like `system "foo", "-v"`.

`make check` or equivalent should be enabled if the package provides it. This should become a classic:
`make check` or equivalent should be enabled if the package provides it:

option "without-check", "Disable build-time checking (not recommended)"
...
system "make"
system "make", "check" if build.with? "check"
system "make", "install"

If this target takes an inordinate amount of resources or is otherwise problematic the option can be switched to `"with-check"`, which will disable checking in the default build.
If this target takes an inordinate amount of resources or is otherwise problematic the option can be switched to `"with-check"`, disabling `make check` in the default build.

#### Revisions

Adding or incrementing a [formula revision] forces a formula upgrade, for instance when breakage from an upgraded dependency necessitates rebuilding the downstream package. When upgrading a formula to a new version, however, any existing revision needs to be reset (i.e. removed).

#### Bottles

[Bottles] are Homebrew's pre-compiled binary packages. Please avoid making any changes to the bottle block. Bottle checksums, URLs, and revisions are handled automatically by [Brew Test Bot].

## Submitting a Pull Request
First read core Homebrew's [How To Open a Homebrew Pull Request (and get it merged)]. The Homebrew/science tap repository is located in `$(brew --repository)/Library/Taps/homebrew/homebrew-science`.

First read core Homebrew's [How To Open a Homebrew Pull Request (and get it merged)]. The Homebrew Science tap repository is located in `$(brew --repository)/Library/Taps/homebrew/homebrew-science`.

Check [open pull requests] before submitting a duplicate. We prefer one formula per PR.

Start you commit messages with a short informative summary, prefaced by the formula name:
Preface your commit message with the formula name, followed by a brief summary:
* `foo: add test`
* `bar: make X11 optional`
Version upgrades should just be titled with their version:
Expand All @@ -39,43 +52,51 @@ Version upgrades should just be titled with their version:
Use the rest of the commit message to describe your changes and link to any relevant issues. When your submission is ready to merge, squash all your commits to a single commit and push to your remote branch, with `--force` if necessary.

## Pull Request vs. Tap
Anyone can host their own [tap]. Homebrew/science may give your formula wider visibility but a tap is preferable when:

Anyone can host their own tap (see [Interesting Taps & Branches]). Homebrew Science may give your formula wider visibility, but a tap is preferable when:
* Your formula must be brewable urgently.
* It is part of a group of specialized and/or related formulæ.
* It is head-only or lacks a stable tagged release.
* It is HEAD-only or lacks a stable tagged release.

Feel free to start your own tap and submit to Homebrew/science later.
Feel free to start your own tap and submit to Homebrew Science later.

## Useful Snippets and Notes

#### Linking Dependencies
Avoid refering to `HOMEBREW_PREFIX` in a formula. If you need to refer to other libraries or header files, use stable `opt` paths: `Formula["foo"].opt_prefix`, `Formula["foo"].opt_lib`, `Formula["foo"].opt_include`, etc.

Avoid refering to `HOMEBREW_PREFIX` in a formula. If you need to refer to dependency libraries or header files, use stable `opt` paths: `Formula["foo"].opt_prefix`, `Formula["foo"].opt_lib`, `Formula["foo"].opt_include`, etc.

#### OpenMP
The current version of Clang, which is the default C compiler used in Homebrew, doesn't support OpenMP, but GCC does. Here's an example of alerting the user that OpenMP will not be enabled if using Clang:

opoo "Clang does not support OpenMP. Compile with gcc if this is not acceptable." if ENV.compiler == :clang
The current version of clang, Homebrew's default C/C++ compiler, does not support OpenMP, but GCC does. Here's an example of alerting the user that OpenMP will not be enabled if using clang:

This snippet will not abort compilation but output a warning message.
opoo "clang does not support OpenMP. Compile with gcc if this is not acceptable." if ENV.compiler == :clang

formulæ which require OpenMP support should specify
This snippet will not abort compilation but output a warning message.

needs :openmp
If OpenMP support is obligatory, `needs :cxx11` may be used to avoid building with clang/LLVM altogether.

#### MPI
Depending on `:mpi` is more flexible than depending directly on `mpich2` or `open-mpi`. Remember that users could have installed either and that the two `conflict_with` each other.

Depending on `:mpi` is more flexible than depending directly on `mpich2` or `open-mpi`. Remember that users could have installed either and the two `conflict_with` each other.

#### Checking What Options Were Used to Build a Dependency

nprocs = Tab.for_formula("foo").without?("mpi") ? 1 : 2

## Suggestions

Improvements to this guide are appreciated via issues or pull requests. If you're willing to add a new section to this documentation or the wiki, we would very much welcome your contribution.

[Homebrew/science]: https://github.com/Homebrew/homebrew-science
[Homebrew Science]: https://github.com/Homebrew/homebrew-science
[open pull requests]: https://github.com/Homebrew/homebrew-science/pulls
[How To Open a Homebrew Pull Request (and get it merged)]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md
[tap]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Interesting-Taps-%26-Branches.md#interesting-taps--branches
[Interesting Taps & Branches]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Interesting-Taps-%26-Branches.md#interesting-taps--branches
[Formula revision]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md#formulae-revisions
[Bottles]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Bottles.md
[Brew Test Bot]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Brew-Test-Bot.md#brew-test-bot
[GitHub Ruby Styleguide]: https://github.com/styleguide/ruby
[Formula Cookbook]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
[Acceptable Formulae]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Acceptable-Formulae.md
[Python for Formula Authors]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Python-for-Formula-Authors.md
[Python for Formula Authors]: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Python-for-Formula-Authors.md
[Gist]: https://gist.github.com/

0 comments on commit 9b293e5

Please sign in to comment.