This repository has been archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy path_base-ruby-augeas.rb
113 lines (96 loc) · 4.15 KB
/
_base-ruby-augeas.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This file is a basis for multiple versions/targets of ruby-augeas.
# It should not be included as a component; Instead other components should
# load it with instance_eval. See ruby-x.y-augeas.rb configs.
#
pkg.add_source("file://resources/patches/augeas/ruby-augeas-0.5.0-patch_c_extension.patch")
# We can remove the below patch after https://github.com/hercules-team/ruby-augeas/pull/17 is merged.
pkg.add_source("file://resources/patches/augeas/ruby-augeas-0.5.0-patch_remove_unused_parameter.patch")
# These can be overridden by the including component.
ruby_version ||= settings[:ruby_version]
host_ruby ||= settings[:host_ruby]
ruby_dir ||= settings[:ruby_dir]
ruby_bindir ||= settings[:ruby_bindir]
pkg.version "0.5.0"
pkg.md5sum "a132eace43ce13ccd059e22c0b1188ac"
pkg.url "http://download.augeas.net/ruby/ruby-augeas-#{pkg.get_version}.tgz"
pkg.mirror "#{settings[:buildsources_url]}/ruby-augeas-#{pkg.get_version}.tgz"
pkg.build_requires "ruby-#{ruby_version}"
pkg.build_requires "augeas"
if platform.name == 'sles-11-x86_64'
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)"
else
pkg.environment "PATH", "$(PATH):/opt/pl-build-tools/bin:/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:/usr/sfw/bin"
end
if platform.is_aix?
if platform.name == 'aix-7.1-ppc'
pkg.environment "CC", "/opt/pl-build-tools/bin/gcc"
# pl-build-tools was added to PATH above
else
pkg.environment "CC", "/opt/freeware/bin/gcc"
pkg.environment "PATH", "$(PATH):/opt/freeware/bin"
end
pkg.environment "RUBY", host_ruby
pkg.environment "LDFLAGS", " -brtl #{settings[:ldflags]}"
end
pkg.environment "CONFIGURE_ARGS", '--vendor'
pkg.environment "PKG_CONFIG_PATH", "#{File.join(settings[:libdir], 'pkgconfig')}:/usr/lib/pkgconfig"
if platform.is_solaris?
if platform.is_cross_compiled?
pkg.environment "RUBY", host_ruby
end
if !platform.is_cross_compiled? && platform.architecture == 'sparc'
ruby = File.join(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.
ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb"
end
elsif platform.is_cross_compiled?
if platform.is_linux? || platform.is_macos?
pkg.environment "RUBY", host_ruby
pkg.environment 'CC', 'clang -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CC', 'clang -target arm64-apple-macos12' if platform.name =~ /osx-12/
ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb"
pkg.environment "LDFLAGS", settings[:ldflags]
end
elsif platform.is_macos? && platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment "PATH", "$(PATH):/opt/homebrew/bin"
pkg.environment 'CC', 'clang'
pkg.environment "LDFLAGS", settings[:ldflags]
ruby = File.join(ruby_bindir, 'ruby')
else
ruby = File.join(ruby_bindir, 'ruby')
end
pkg.build do
build_commands = []
if ruby_version =~ /^3/
build_commands << "#{platform.patch} --strip=2 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../ruby-augeas-0.5.0-patch_c_extension.patch"
end
build_commands << "#{platform.patch} --strip=2 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../ruby-augeas-0.5.0-patch_remove_unused_parameter.patch"
build_commands << "#{ruby} ext/augeas/extconf.rb"
build_commands << "#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1)"
build_commands
end
if settings[:ruby_vendordir]
augeas_rb_target = File.join(settings[:ruby_vendordir], 'augeas.rb')
else
# If no alternate vendordir has been set, install into default
# vendordir for this ruby version.
augeas_rb_target = File.join(ruby_dir, 'lib', 'ruby', 'vendor_ruby', 'augeas.rb')
end
pkg.install_file 'lib/augeas.rb', augeas_rb_target
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