Skip to content

Commit

Permalink
doc: update README with GNU/Musl description.
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jan 19, 2024
1 parent 1baaf03 commit 36b9577
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,43 @@ This is kind of successor of [rake-compiler-dev-box](https://github.com/tjschuck
It is wrapped as a gem for easier setup, usage and integration and is based on lightweight Docker containers.
It is also more reliable, since the underlying docker images are versioned and immutable.

## Supported platforms

The following platforms are supported for cross-compilation by rake-compiler-dock:

- `aarch64-linux` and `aarch64-linux-gnu`
- `aarch64-linux-musl`
- `arm-linux` and `arm-linux-gnu`
- `arm-linux-musl`
- `arm64-darwin`
- `jruby`
- `x64-mingw-ucrt`
- `x64-mingw32`
- `x86-linux` and `x86-linux-gnu`
- `x86-linux-musl`
- `x86-mingw32`
- `x86_64-darwin`
- `x86_64-linux` and `x86_64-linux-gnu`
- `x86_64-linux-musl`

### Windows

`x64-mingw-ucrt` should be used for Ruby 3.1 and later on windows. `x64-mingw32` should be used for Ruby 3.0 and earlier.

### GNU and Musl

Platform names with a `*-linux` suffix are aliases for `*-linux-gnu`, since the Rubygems default is to assume `gnu` if no libc is specified.

Some C extensions may not require separate GNU and Musl builds, in which case it's acceptable to ship a single `*-linux` gem to cover both platforms.

The `*-linux-gnu` and `*-linux-musl` platform name suffixes require Rubygems 3.3.22 or later (or Bundler 2.3.21 or later) at installation time. Ruby version 3.0 and later ship with a sufficient Rubygems version, but versions compatible with earlier Rubies are:

- ruby: "2.7", rubygems: "3.4.22"
- ruby: "2.6", rubygems: "3.4.22"
- ruby: "2.5", rubygems: "3.3.26"
- ruby: "2.4", rubygems: "3.3.26"


## Installation

Install docker [following the instructions on the docker website](https://docs.docker.com/engine/install/) ... or install [docker-toolbox for Windows and OSX](https://github.com/docker/toolbox/releases) or boot2docker on [Windows](https://github.com/boot2docker/windows-installer/releases) or [OS X](https://github.com/boot2docker/osx-installer/releases) .
Expand All @@ -33,10 +70,12 @@ Your Rakefile should enable cross compilation like so:
```ruby
exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
ext.cross_compile = true
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux-gnu x86_64-linux-gnu x86_64-darwin arm64-darwin]
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux x86_64-darwin arm64-darwin]
end
```

where you should choose your platforms from the list in the "Supported platforms" section.

See below, how to invoke cross builds in your Rakefile.

Additionally it may also be used to build ffi based binary gems like [libusb](https://github.com/larskanis/libusb), but currently doesn't provide any additional build helpers for this use case, beyond docker invocation and cross compilers.
Expand Down

0 comments on commit 36b9577

Please sign in to comment.