-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #832 from cthorn42/maint/main/nokogiri_gem_install…
…_patch (maint) Use packaged libxml to build nokogiri on MacOS
- Loading branch information
Showing
2 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
component 'rubygem-nokogiri' do |pkg, _settings, _platform| | ||
pkg.version '1.14.2' | ||
pkg.sha256sum 'c765a74aac6cf430a710bb0b6038b8ee11f177393cd6ae8dadc7a44a6e2658b6' | ||
# On macOS when we are not cross compiling we need to use runtime's libxml2 and libxslt | ||
if platform.is_macos? && !platform.is_cross_compiled? | ||
settings[:gem_install_options] = "-- --use-system-libraries \ | ||
--with-xml2-lib=#{settings[:libdir]} \ | ||
--with-xml2-include=#{settings[:includedir]}/libxml2 \ | ||
--with-xslt-lib=#{settings[:libdir]} \ | ||
--with-xslt-include=#{settings[:includedir]}" | ||
end | ||
instance_eval File.read('configs/components/_base-rubygem.rb') | ||
|
||
pkg.build_requires 'rubygem-mini_portile2' | ||
|
||
gem_home = settings[:gem_home] | ||
pkg.environment "GEM_HOME", gem_home | ||
|
||
# When cross compiling nokogiri native extensions on macOS 11/12 ARM, there is a 94M tmp | ||
# directory that's not needed | ||
if platform.is_macos? && platform.architecture == 'arm64' | ||
install do | ||
"rm -r #{gem_home}/gems/nokogiri-#{pkg.get_version}/ext/nokogiri/tmp" | ||
if platform.is_macos? | ||
pkg.environment "PKG_CONFIG_PATH", "#{settings[:libdir]}/pkgconfig" | ||
if platform.is_cross_compiled? | ||
pkg.install do | ||
"rm -r #{gem_home}/gems/nokogiri-#{pkg.get_version}/ext/nokogiri/tmp" | ||
end | ||
end | ||
end | ||
end |