-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpl-ruby-patch.rb
More file actions
35 lines (32 loc) · 1.32 KB
/
pl-ruby-patch.rb
File metadata and controls
35 lines (32 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This component patches the pl-ruby package on cross compiled
# platforms. Ruby gem components should require this.
#
# We have to do this when installing gems with native extensions in
# order to trick rubygems into thinking we have a different ruby
# version and target architecture
#
# This component should also be present in the puppet-agent project
component 'pl-ruby-patch' do |pkg, settings, platform|
if platform.is_cross_compiled?
pkg.add_source('file://resources/files/ruby/patch-hostruby.rb')
# The `target_triple` determines which directory native extensions are stored in the
# compiled ruby and must match ruby's naming convention.
# weird architecture naming conventions...
target_triple = if platform.architecture =~ /ppc64el|ppc64le/
'powerpc64le-linux'
elsif platform.name == 'solaris-11-sparc'
'sparc-solaris-2.11'
elsif platform.name =~ /solaris-10/
'sparc-solaris'
elsif platform.is_macos?
'arm64-darwin'
else
"#{platform.architecture}-linux"
end
pkg.install do
[
"#{settings[:host_ruby]} patch-hostruby.rb #{settings[:ruby_version]} #{target_triple}"
]
end
end
end