Skip to content

Commit

Permalink
OpenBSD-specific development guide (mastodon#463)
Browse files Browse the repository at this point in the history
* OpenBSD-specific development guide

The GNU/Linux setup works well but there are some OpenBSD-specific
considerations around default compilers, discovering third-party
libraries, and linker warnings.

* Fix typos
  • Loading branch information
mike-burns authored and Gargron committed Nov 27, 2017
1 parent 69c6a4d commit ff454d3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Running-Mastodon/Development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,43 @@ You can check code quality with:

rubocop

## OpenBSD

Follow the Linux setup as described above, but with these considerations:

- If you use a Ruby version manager (chruby, rbenv, rvm, etc.), you _must_
configure Ruby with `CC=clang CXX=clang++`. This instructs Ruby to use that
compiler when compiling native C gems.
- Many native C gems need to be told about `/usr/local`. You can do this by
configuring a `build.gem_name` value using `bundle config`.
- Any C gem that uses mkmf.rb's `pkg_config` method might fail if the linker
produces warnings, as happens when a library links with `sprintf(3)`. The
`cld3` gem uses `pkg_config('protobuf')`; if you have protobuf installed but
it cannot be found while building the gem, this is likely the problem. You
will need to directly modify `mkmf.rb` to get this to install.

The bundle configuration as of Mastodon 2.0's Gemfile:

```sh
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/local/include/libxml2/ --with-opt-include=/usr/local/include --with-xslt-include=/usr/local/include/libxslt --with-exslt-include=/usr/local/include/libexslt --with-xml2-lib=/usr/local/lib
bundle config build.charlock_holmes --with-icu-dir=/usr/local --with-opt-dir=/usr/local
bundle config build.idn-ruby --with-idn-dir=/usr/local
```

Modify `mfmk.rb`:

```
@@ -655,7 +655,7 @@
end
def try_ldflags(flags, opts = {})
- try_link(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
+ try_link(MAIN_DOES_NOTHING, flags, {:werror => false}.update(opts))
end
def append_ldflags(flags, *opts)
```

## Mac

These are self-contained instructions for setting up a development environment on a macOS system. It is assumed that you’ve cloned your fork of Mastodon to a local working directory and that you are in Terminal and in that directory.
Expand Down

0 comments on commit ff454d3

Please sign in to comment.