Repository navigation
Expand file tree
/
Copy pathruby-augeas.rb
More file actions
67 lines (57 loc) · 2.68 KB
/
Copy pathruby-augeas.rb
File metadata and controls
67 lines (57 loc) · 2.68 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
#####
# Component release information:
# https://github.com/hercules-team/ruby-augeas/releases
#####
component 'ruby-augeas' do |pkg, settings, platform|
pkg.load_from_json('configs/components/ruby-augeas.json')
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"
ruby = File.join(settings[:ruby_bindir], 'ruby')
if 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]
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|amazon-20/
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
# Clean after install in case we are building for multiple rubies.
pkg.install do
"#{platform[:make]} -e clean"
end
end