-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathruby-augeas.rb
More file actions
98 lines (86 loc) · 4.11 KB
/
ruby-augeas.rb
File metadata and controls
98 lines (86 loc) · 4.11 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#####
# Component release information:
# https://github.com/hercules-team/ruby-augeas/releases
#####
component 'ruby-augeas' do |pkg, settings, platform|
pkg.version '0.6.0'
pkg.sha256sum '98158a54c655b4823439b4bd38609f01e0b912a3d1453144082b8a5f43b0c4dc'
pkg.url "https://github.com/hercules-team/ruby-augeas/releases/download/release-#{pkg.get_version}/ruby-augeas-#{pkg.get_version}.tgz"
pkg.build_requires "ruby-#{settings[:ruby_version]}"
pkg.build_requires 'augeas'
pkg.environment 'PATH', '$(PATH):/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:/usr/sfw/bin'
pkg.environment 'CONFIGURE_ARGS', '--vendor'
pkg.environment 'PKG_CONFIG_PATH', "#{File.join(settings[:libdir], 'pkgconfig')}:/usr/lib/pkgconfig"
if platform.is_aix?
pkg.environment 'CC', '/opt/freeware/bin/gcc'
pkg.environment 'PATH', '$(PATH):/opt/freeware/bin'
pkg.environment 'RUBY', settings[:host_ruby]
pkg.environment 'LDFLAGS', " -brtl #{settings[:ldflags]}"
end
if platform.is_solaris?
pkg.environment 'RUBY', settings[:host_ruby] if platform.is_cross_compiled?
ruby = if !platform.is_cross_compiled? && platform.architecture == 'sparc'
File.join(settings[:ruby_bindir], 'ruby')
else
# This should really only be done when cross compiling but
# to avoid breaking solaris x86_64 in 7.x continue preloading
# our hook.
"#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb"
end
elsif platform.is_cross_compiled? && (platform.is_linux? || platform.is_macos?)
pkg.environment 'RUBY', settings[:host_ruby]
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb"
pkg.environment 'LDFLAGS', settings[:ldflags]
elsif platform.is_macos?
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin' if platform.architecture == 'arm64'
pkg.environment 'CC', settings[:cc]
pkg.environment 'CFLAGS', settings[:cflags]
pkg.environment 'LDFLAGS', settings[:ldflags]
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]
ruby = File.join(settings[:ruby_bindir], 'ruby')
else
ruby = File.join(settings[:ruby_bindir], 'ruby')
end
pkg.build do
build_commands = []
extconf = "#{ruby} ext/augeas/extconf.rb"
# WORKAROUND
# RedHat has a long call chain for package-config
#
# Explanation:
# redhat derivatives use a pkg-conf-shim. Detailed call path:
# /usr/bin/pkg-config --exists augeas
# calls
# LD_LIBRARY_PATH=/opt/puppetlabs/puppet/lib rpm --eval '%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}'
# rpm: symbol lookup error: /lib64/librpm_sequoia.so.1: undefined symbol: EVP_idea_cfb64, version OPENSSL_3.0.0
# and it breaks. The intention seems to be to get the current architecture and call
# /usr/bin/x86_64-linux-gnu-pkg-config
# which sets PKG_CONFIG_PATH variables and calls
# /usr/bin/pkgconf
# we will skip the RedHat call stack and call the pkgconf binary directly.
extconf += ' --with-pkg-config=/usr/bin/pkgconf' if platform.name =~ /((el|redhatfips)-(9|10))|fedora/
build_commands << extconf
build_commands << "#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1)"
build_commands
end
augeas_rb_target = settings[:ruby_vendordir] if settings[:ruby_vendordir]
# If no alternate vendordir has been set, install into default
# vendordir for this ruby version.
augeas_rb_target ||= File.join(settings[:ruby_dir], 'lib', 'ruby', 'vendor_ruby')
pkg.install_file 'lib/augeas.rb', File.join(augeas_rb_target, 'augeas.rb')
pkg.install_file 'lib/augeas/facade.rb', File.join(augeas_rb_target, 'augeas', 'facade.rb')
pkg.install do
[
"#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1) DESTDIR=/ install"
]
end
if platform.is_solaris? || platform.is_cross_compiled_linux?
pkg.install do
"chown root:root #{augeas_rb_target}"
end
end
# Clean after install in case we are building for multiple rubies.
pkg.install do
"#{platform[:make]} -e clean"
end
end