Add this line to your application’s Gemfile:
gem "ffi-libarchive-binary"And then execute:
$ bundle installOr install it yourself as:
$ gem install ffi-libarchive-binaryRequire the gem and use calls from ffi-libarchive.
require "ffi-libarchive-binary"
path = File.expand_path('file.pkg', __dir__)
flags = Archive::EXTRACT_PERM
reader = Archive::Reader.open_filename(path)
reader.each_entry do |entry|
reader.extract(entry, flags.to_i)
end
reader.closeWe are following Sandi Metz’s Rules for this gem, you can read the description of the rules here. All new code should follow these rules. If you make changes in a pre-existing file that violates these rules you should fix the violations as part of your contribution.
The gem uses an automated release workflow that handles version bumping and
publishing to RubyGems using the gem-release gem.
The release process is managed through GitHub Actions workflow dispatch:
-
Navigate to the Actions tab in the GitHub repository
-
Select the "release" workflow
-
Click "Run workflow"
-
Choose the version bump type:
-
x.y.z- Set a specific version (e.g.,1.2.3) -
major- Bump major version (e.g.,0.4.2→1.0.0) -
minor- Bump minor version (e.g.,0.4.2→0.5.0) -
patch- Bump patch version (e.g.,0.4.2→0.4.3) -
skip- Publish current version without bumping (useful for republishing)
-
The workflow will:
-
Install the
gem-releasegem -
Bump the version in [
lib/ffi-libarchive-binary/version.rb](lib/ffi-libarchive-binary/version.rb:4) (if not skip) -
Create a git commit with the version change
-
Create a git tag (
vX.Y.Z) -
Push changes to the repository
-
Build platform-specific gems for all supported platforms
-
Publish all gems to RubyGems
|
Note
|
The workflow uses the gem-release gem which provides a reliable and
well-tested version bumping mechanism used across many Ruby projects.
|
For manual releases, you can use the gem-release gem directly:
# Install gem-release if not already installed
gem install gem-release
# Bump patch version (0.4.2 -> 0.4.3) and create tag
gem bump --version patch --tag --push
# Bump minor version (0.4.2 -> 0.5.0) and create tag
gem bump --version minor --tag --push
# Bump major version (0.4.2 -> 1.0.0) and create tag
gem bump --version major --tag --push
# Set specific version and create tag
gem bump --version 1.2.3 --tag --pushOnce the tag is pushed, the release workflow will automatically trigger and build the gems for all platforms.
The gem uses centralized platform configuration in [.github/platforms.json](.github/platforms.json:1)
as the single source of truth for all platform-specific settings.
Each platform entry includes:
-
platform- Platform identifier for gem naming (e.g.,x86_64-linux) -
os- GitHub Actions runner to use for building -
ruby- Ruby version to use -
description- Human-readable description -
build- Whether to build a gem for this platform -
test- Whether to test this platform -
test_os- Array of OS runners to test on (if applicable) -
cross_compile- Whether this requires cross-compilation -
notes- Additional information
Use the provided script to list all configured platforms:
# List all platforms
bin/list-platforms
# List only build platforms
bin/list-platforms --build
# List only test platforms
bin/list-platforms --testTo add or modify platform support:
-
Edit [
.github/platforms.json](.github/platforms.json:1) -
Update the platform entry with appropriate settings
-
Set
"build": trueto enable building for that platform -
Set
"test": trueto enable testing for that platform -
Update the platform arrays (
build_platformsandtest_platforms) at the bottom of the file
|
Note
|
When adding a new platform, ensure the GitHub Actions runner is available and the build toolchain is properly configured. |
First, thank you for contributing! We love pull requests from everyone. By participating in this project, you hereby grant Ribose Inc. the right to grant or transfer an unlimited number of non exclusive licenses or sub-licenses to third parties, under the copyright covering the contribution to use the contribution by all means.
Here are a few technical guidelines to follow:
-
Open an issue to discuss a new feature.
-
Write tests to support your new feature.
-
Make sure the entire test suite passes locally and on CI.
-
Open a Pull Request.
-
Squash your commits after receiving feedback.
-
Party!
This gem is distributed with a BSD 3-Clause license.
This gem is developed, maintained and funded by Ribose Inc.
The following platforms are officially tested and supported:
| Platform | Architecture | Ruby Versions | Status |
|---|---|---|---|
Windows 2022 |
x86_64 |
3.1+ |
✅ Supported |
Windows 2025 |
x86_64 |
3.1+ |
✅ Supported |
Windows 11 ARM |
ARM64 |
3.4+ |
✅ Supported |
macOS 15 |
ARM64 (Apple Silicon) |
3.1+ |
✅ Supported |
macOS 15 Large |
x86_64 (Intel) |
3.1+ |
✅ Supported |
macOS 26 |
ARM64 (Apple Silicon) |
3.1+ |
✅ Supported |
Ubuntu 24.04 |
x86_64 (glibc) |
3.1+ |
✅ Supported |
Ubuntu 22.04 |
x86_64 (glibc) |
3.1+ |
✅ Supported |
Alpine Linux |
x86_64 (musl) |
3.1+ |
✅ Supported |
Ubuntu 24.04 |
ARM64 (glibc) |
3.1+ |
✅ Supported |
Ubuntu 22.04 |
ARM64 (glibc) |
3.1+ |
✅ Supported |
Alpine Linux |
ARM64 (musl) |
3.1+ |
✅ Supported |
|
Note
|
The gem provides pre-compiled binaries for 11 platforms. Separate binaries are provided for glibc-based (gnu) and musl-based Linux distributions to ensure compatibility. |
The gem explicitly sets OpenSSL compiler targets to ensure correct assembly code generation:
| Platform | Compiler Target | Reason |
|---|---|---|
Windows x64 |
|
Explicit x86_64 assembly selection |
Linux x86_64 (gnu/musl) |
Auto-detect |
Native toolchain works correctly |
Linux ARM64 (gnu/musl) |
Auto-detect |
Native toolchain works correctly |
macOS ARM64 |
Auto-detect |
Native toolchain works correctly |
macOS x64 |
Auto-detect |
Native toolchain works correctly |
|
Note
|
Windows platforms require explicit compiler targets because OpenSSL’s auto-detection does not reliably select the correct target on Windows. Linux musl and glibc variants use the same OpenSSL configuration with auto-detection, as the toolchain correctly identifies the target. |