Skip to content

fix: build from source when a gem has build options - #37

Merged
Thejus-Paul merged 2 commits into
mainfrom
fix/34-respect-build-args
Oct 4, 2026
Merged

Thejus-Paul merged 2 commits into
mainfrom
fix/34-respect-build-args

Conversation

@Thejus-Paul

Copy link
Copy Markdown
Member

Fixes #34

A project that passes a build option to a native gem through Bundler, for example telling pg which PostgreSQL install to compile against, lost that option whenever prebake found the gem in the cache. The install reported success, but the gem that landed was a copy compiled ahead of time with default options. Nothing told the developer that their setting had no effect.

A gem with build options is now always compiled from source, so the project's setting takes effect whether or not a prebuilt copy is in the cache. Gems without build options install from the cache as before.

Bundler hands the options from `bundle config build.<gem>` to
Gem::Ext::Builder as build args, and `gem install <gem> -- <options>`
does the same. The cache lookup never read them, so a cache hit
installed a binary compiled with default options and the project's
setting silently had no effect. pg with --with-pg-config is the common
case.

Cached binaries are always built with default options, so a gem with
build args now skips the cache and goes straight to the source build.
@Thejus-Paul Thejus-Paul self-assigned this Oct 4, 2026
@Thejus-Paul
Thejus-Paul marked this pull request as ready for review October 4, 2026 11:26
@Thejus-Paul
Thejus-Paul merged commit 719c964 into main Oct 4, 2026
6 checks passed
@Thejus-Paul
Thejus-Paul deleted the fix/34-respect-build-args branch October 4, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build options set through Bundler are ignored when a gem installs from the cache

1 participant