forked from puppetlabs/puppet-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruby-shadow.rb
72 lines (65 loc) · 2.79 KB
/
ruby-shadow.rb
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
component "ruby-shadow" do |pkg, settings, platform|
pkg.url "https://github.com/apalmblad/ruby-shadow"
pkg.ref "refs/tags/2.5.0"
pkg.build_requires "ruby-#{settings[:ruby_version]}"
pkg.environment "PATH", "$(PATH):/usr/ccs/bin:/usr/sfw/bin"
pkg.environment "CONFIGURE_ARGS", '--vendor'
if platform.is_solaris?
if platform.architecture == 'sparc'
pkg.environment "RUBY", settings[:host_ruby]
end
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb"
elsif platform.is_cross_compiled?
pkg.environment "RUBY", settings[:host_ruby]
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb"
else
ruby = File.join(settings[:ruby_bindir], 'ruby')
end
# This is a disturbing workaround needed for s390x based systems, that
# for some reason isn't encountered with our other architecture cross
# builds. When trying to build the libshadow test cases for extconf.rb,
# the process fails with "/opt/pl-build-tools/bin/s390x-linux-gnu-gcc:
# error while loading shared libraries: /opt/puppetlabs/puppet/lib/libstdc++.so.6:
# ELF file data encoding not little-endian". It will also complain in
# the same way about libgcc. If however we temporarily move these
# libraries out of the way, extconf.rb and the cross-compile work
# properly. This needs to be fixed, but I've spent over a week analyzing
# every possible angle that could cause this, from rbconfig settings to
# strace logs, and we need to move forward on this platform.
# FIXME: Scott Garman Jun 2016
# Added to ppc64
if platform.architecture == "ppc64"
pkg.configure do
[
"mkdir #{settings[:libdir]}/hide",
"mv #{settings[:libdir]}/libstdc* #{settings[:libdir]}/hide/",
"mv #{settings[:libdir]}/libgcc* #{settings[:libdir]}/hide/"
]
end
end
matchdata = platform.settings[:ruby_version].match /(\d+)\.(\d+)\.\d+/
ruby_major_version = matchdata[1].to_i
if ruby_major_version >= 3
base = "resources/patches/ruby_32"
# https://github.com/apalmblad/ruby-shadow/issues/26
# if ruby-shadow gets a 3 release this should be removed
pkg.apply_patch "#{base}/ruby-shadow-taint.patch", strip: "1"
pkg.apply_patch "#{base}/ruby-shadow-rbconfig.patch", strip: "1"
end
pkg.build do
["#{ruby} extconf.rb",
"#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1)"]
end
pkg.install do
["#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1) DESTDIR=/ install"]
end
# Undo the gross hack from the configure step
if platform.architecture == "ppc64"
pkg.install do
[
"mv #{settings[:libdir]}/hide/* #{settings[:libdir]}/",
"rmdir #{settings[:libdir]}/hide/"
]
end
end
end