This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy path_base-rubygem.rb
54 lines (46 loc) · 2.5 KB
/
_base-rubygem.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
# This file is a common basis for multiple rubygem components.
#
# It should not be included as a component itself; Instead, other components
# should load it with instance_eval after setting pkg.version. Parts of this
# shared configuration may be overridden afterward.
name = pkg.get_name.gsub('rubygem-', '')
unless name && !name.empty?
raise "Rubygem component files that instance_eval _base-rubygem must be named rubygem-<gem-name>.rb"
end
version = pkg.get_version
unless version && !version.empty?
raise "You must set the `pkg.version` in your rubygem component before instance_eval'ing _base_rubygem.rb"
end
pkg.build_requires "runtime-#{settings[:runtime_project]}"
pkg.build_requires "pl-ruby-patch" if platform.is_cross_compiled?
if platform.is_windows?
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:$(PATH)"
end
# When cross-compiling, we can't use the rubygems we just built.
# Instead we use the host gem installation and override GEM_HOME. Yay?
pkg.environment "GEM_HOME", settings[:gem_home]
pkg.environment "GEM_PATH", settings[:gem_home]
# PA-25 in order to install gems in a cross-compiled environment we need to
# set RUBYLIB to include puppet and hiera, so that their gemspecs can resolve
# hiera/version and puppet/version requires. Without this the gem install
# will fail by blowing out the stack.
if settings[:ruby_vendordir]
pkg.environment "RUBYLIB", "#{settings[:ruby_vendordir]}:$(RUBYLIB)"
end
pkg.url("https://rubygems.org/downloads/#{name}-#{version}.gem")
pkg.mirror("#{settings[:buildsources_url]}/#{name}-#{version}.gem")
# If a gem needs more command line options to install set the :gem_install_options
# in its component file rubygem-<compoment>, before the instance_eval of this file.
gem_install_options = settings["#{pkg.get_name}_gem_install_options".to_sym]
remove_older_versions = settings["#{pkg.get_name}_remove_older_versions".to_sym]
# Set a default gem_uninstall
gem_uninstall = settings[:gem_uninstall] || "#{settings[:host_gem]} uninstall --all --ignore-dependencies"
pkg.install do
steps = []
steps << "#{gem_uninstall} #{name}" if remove_older_versions
steps << if gem_install_options.nil?
"#{settings[:gem_install]} #{name}-#{version}.gem"
else
"#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}"
end
end