rubyinstaller-build 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/ISSUE_TEMPLATE.md +8 -0
- data/.gitignore +12 -0
- data/.yardopts +7 -0
- data/CHANGELOG-2.4.md +166 -0
- data/CHANGELOG-2.5.md +87 -0
- data/CHANGELOG-2.6.md +62 -0
- data/CHANGELOG-2.7.md +22 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +25 -0
- data/README.md +114 -0
- data/Rakefile +164 -0
- data/appveyor-key.asc.asc +61 -0
- data/appveyor.yml +141 -0
- data/docker/Dockerfile +50 -0
- data/docker/Rakefile +22 -0
- data/gems/rubyinstaller-build.yaml +2 -0
- data/lib/devkit.rb +3 -0
- data/lib/ruby_installer.rb +3 -0
- data/lib/ruby_installer/build.rb +23 -0
- data/lib/ruby_installer/build/ca_cert_file.rb +66 -0
- data/lib/ruby_installer/build/colors.rb +45 -0
- data/lib/ruby_installer/build/components/01_msys2.rb +97 -0
- data/lib/ruby_installer/build/components/02_pacman_update.rb +35 -0
- data/lib/ruby_installer/build/components/03_dev_tools.rb +68 -0
- data/lib/ruby_installer/build/components/base.rb +58 -0
- data/lib/ruby_installer/build/components_installer.rb +53 -0
- data/lib/ruby_installer/build/dll_directory.rb +97 -0
- data/lib/ruby_installer/build/erb_compiler.rb +61 -0
- data/lib/ruby_installer/build/gem_version.rb +5 -0
- data/lib/ruby_installer/build/gems.rb +74 -0
- data/lib/ruby_installer/build/msys2_installation.rb +280 -0
- data/lib/ruby_installer/build/openstruct.rb +29 -0
- data/lib/ruby_installer/build/release.rb +120 -0
- data/lib/ruby_installer/build/singleton.rb +45 -0
- data/lib/ruby_installer/build/task.rb +20 -0
- data/lib/ruby_installer/build/utils.rb +110 -0
- data/lib/ruby_installer/runtime.rb +18 -0
- data/lib/ruby_installer/runtime/ridk.rb +195 -0
- data/packages/ri-msys/Rakefile +72 -0
- data/packages/ri-msys/recipes/sandbox/70-add-msys2-installation.rake +18 -0
- data/packages/ri/Rakefile +60 -0
- data/recipes/archive-7z/10-define-variables.rake +2 -0
- data/recipes/archive-7z/70-create-archive.rake +10 -0
- data/recipes/archive-7z/90-define-main-task.rake +2 -0
- data/recipes/installer-inno/10-define-variables.rake +2 -0
- data/recipes/installer-inno/50-generate-filelist.rake +28 -0
- data/recipes/installer-inno/60-generate-iss-file.rake +8 -0
- data/recipes/installer-inno/70-run-iscc.rake +19 -0
- data/recipes/installer-inno/90-define-main-task.rake +2 -0
- data/recipes/installer-inno/events.iss +88 -0
- data/recipes/installer-inno/images/fake.bmp +0 -0
- data/recipes/installer-inno/images/wizard-large.bmp +0 -0
- data/recipes/installer-inno/images/wizard-logo.bmp +0 -0
- data/recipes/installer-inno/ri_gui.iss +286 -0
- data/recipes/installer-inno/rubyinstaller.iss.erb +157 -0
- data/recipes/installer-inno/util.iss +271 -0
- data/recipes/msys2/10-define-variables.rake +6 -0
- data/recipes/msys2/30-download-msys2-base.rake +4 -0
- data/recipes/msys2/40-extract-msys2-base.rake +9 -0
- data/recipes/msys2/50-init-msys.rake +8 -0
- data/recipes/msys2/50-install-components.rake +19 -0
- data/recipes/msys2/90-define-main-task.rake +2 -0
- data/recipes/sandbox/10-define-variables.rake +6 -0
- data/recipes/sandbox/20-add-runtime-files.rake +15 -0
- data/recipes/sandbox/20-define-import-files.rake +16 -0
- data/recipes/sandbox/20-define-import-readline.rake +28 -0
- data/recipes/sandbox/20-extend-irb.rake +13 -0
- data/recipes/sandbox/40-fix-rake-shebang.rake +6 -0
- data/recipes/sandbox/40-generate-rake-cmd.rake +7 -0
- data/recipes/sandbox/40-generate-version-file.rake +20 -0
- data/recipes/sandbox/50-do-import-files.rake +17 -0
- data/recipes/sandbox/50-gather-sandbox-files.rake +6 -0
- data/recipes/sandbox/60-define-gem-wrappers.rake +5 -0
- data/recipes/sandbox/60-side-by-side-assembly.rake +81 -0
- data/recipes/sandbox/70-add-gem-bin-wrappers.rake +10 -0
- data/recipes/sandbox/70-install-gems.rake +11 -0
- data/recipes/sandbox/80-copy-msys-files.rake +8 -0
- data/recipes/sandbox/90-define-main-task.rake +2 -0
- data/recipes/sandbox/LICENSE.txt +24 -0
- data/recipes/sandbox/rubyinstaller-2.3.4-x64.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.3.4-x86.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.3.4.files +43 -0
- data/recipes/sandbox/rubyinstaller-2.4.10-x64.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.4.10-x86.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.4.10.files +44 -0
- data/recipes/sandbox/rubyinstaller-2.5.8-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.5.8-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.5.8.files +33 -0
- data/recipes/sandbox/rubyinstaller-2.6.6-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.6.6-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.6.6.files +35 -0
- data/recipes/sandbox/rubyinstaller-2.7.1-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.7.1-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.7.1.files +35 -0
- data/recipes/sandbox/rubyinstaller-head-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-head-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-head.files +35 -0
- data/recipes/unpack/10-define-variables.rake +5 -0
- data/recipes/unpack/20-define-msys-packages.rake +1 -0
- data/recipes/unpack/30-add-ri2-repo-to-msys.rake +41 -0
- data/recipes/unpack/50-install-msys-packages.rake +28 -0
- data/recipes/unpack/90-define-main-task.rake +2 -0
- data/recipes/unpack/appveyor-repo-key.asc +29 -0
- data/resources/files/irbrc_predefiner.rb +21 -0
- data/resources/files/operating_system.rb +21 -0
- data/resources/files/readline.rb +17 -0
- data/resources/files/reline.rb +437 -0
- data/resources/files/reline/ansi.rb +177 -0
- data/resources/files/reline/config.rb +297 -0
- data/resources/files/reline/general_io.rb +75 -0
- data/resources/files/reline/history.rb +56 -0
- data/resources/files/reline/key_actor.rb +7 -0
- data/resources/files/reline/key_actor/base.rb +7 -0
- data/resources/files/reline/key_actor/emacs.rb +517 -0
- data/resources/files/reline/key_actor/vi_command.rb +518 -0
- data/resources/files/reline/key_actor/vi_insert.rb +517 -0
- data/resources/files/reline/key_stroke.rb +53 -0
- data/resources/files/reline/kill_ring.rb +113 -0
- data/resources/files/reline/line_editor.rb +2231 -0
- data/resources/files/reline/unicode.rb +527 -0
- data/resources/files/reline/unicode/east_asian_width.rb +1145 -0
- data/resources/files/reline/version.rb +3 -0
- data/resources/files/reline/windows.rb +273 -0
- data/resources/files/ridk.cmd +39 -0
- data/resources/files/ridk.ps1 +26 -0
- data/resources/files/ridk_use/ridk.cmd +13 -0
- data/resources/files/ridk_use/ridk.ps1 +17 -0
- data/resources/files/ridk_use/ridk_use.rb +221 -0
- data/resources/files/setrbvars.cmd +14 -0
- data/resources/icons/ruby-doc.ico +0 -0
- data/resources/ssl/README-SSL.md +37 -0
- data/resources/ssl/c_rehash.rb +167 -0
- data/resources/ssl/cacert.pem +4105 -0
- data/rubyinstaller-build.gemspec +28 -0
- metadata +226 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build
|
|
3
|
+
autoload :CaCertFile, 'ruby_installer/build/ca_cert_file'
|
|
4
|
+
autoload :Colors, 'ruby_installer/build/colors'
|
|
5
|
+
autoload :ComponentsInstaller, 'ruby_installer/build/components_installer'
|
|
6
|
+
autoload :DllDirectory, 'ruby_installer/build/dll_directory'
|
|
7
|
+
autoload :ErbCompiler, 'ruby_installer/build/erb_compiler'
|
|
8
|
+
autoload :Gems, 'ruby_installer/build/gems'
|
|
9
|
+
autoload :Msys2Installation, 'ruby_installer/build/msys2_installation'
|
|
10
|
+
autoload :GEM_VERSION, 'ruby_installer/build/gem_version'
|
|
11
|
+
autoload :Task, 'ruby_installer/build/task'
|
|
12
|
+
autoload :Openstruct, 'ruby_installer/build/openstruct'
|
|
13
|
+
autoload :Release, 'ruby_installer/build/release'
|
|
14
|
+
autoload :Utils, 'ruby_installer/build/utils'
|
|
15
|
+
|
|
16
|
+
module Components
|
|
17
|
+
autoload :Base, 'ruby_installer/build/components/base'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
require 'ruby_installer/build/singleton'
|
|
21
|
+
BuildOrRuntime = self
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build
|
|
3
|
+
class CaCertFile
|
|
4
|
+
attr_reader :content
|
|
5
|
+
|
|
6
|
+
def initialize(content=nil)
|
|
7
|
+
content ||= download_ssl_cacert_pem
|
|
8
|
+
|
|
9
|
+
@content = content
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
MOZILLA_CA_CSV_URI = "https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReportPEMCSV"
|
|
13
|
+
|
|
14
|
+
def download_ssl_cacert_pem
|
|
15
|
+
require 'open-uri'
|
|
16
|
+
require 'csv'
|
|
17
|
+
require 'openssl'
|
|
18
|
+
require 'stringio'
|
|
19
|
+
|
|
20
|
+
csv_data = OpenURI.open_uri(MOZILLA_CA_CSV_URI)
|
|
21
|
+
|
|
22
|
+
fd = StringIO.new
|
|
23
|
+
fd.write <<-EOT
|
|
24
|
+
##
|
|
25
|
+
## Bundle of CA Root Certificates
|
|
26
|
+
##
|
|
27
|
+
## Certificate data from Mozilla as of: #{Time.now.utc}
|
|
28
|
+
##
|
|
29
|
+
## This is a bundle of X.509 certificates of public Certificate Authorities (CA).
|
|
30
|
+
## These were automatically extracted from Mozilla's root certificates CSV file
|
|
31
|
+
## downloaded from:
|
|
32
|
+
## #{MOZILLA_CA_CSV_URI}
|
|
33
|
+
##
|
|
34
|
+
## Further information about the CA certificate list can be found:
|
|
35
|
+
## https://wiki.mozilla.org/CA:IncludedCAs
|
|
36
|
+
##
|
|
37
|
+
## This file is used as default CA certificate list for Ruby.
|
|
38
|
+
## Conversion done with rubyinstaller-build version #{RubyInstaller::Build::GEM_VERSION}.
|
|
39
|
+
##
|
|
40
|
+
EOT
|
|
41
|
+
|
|
42
|
+
CSV.parse(csv_data, headers: true).select do |row|
|
|
43
|
+
row["Trust Bits"].split(";").include?("Websites")
|
|
44
|
+
end.map do |row|
|
|
45
|
+
pem = row["PEM Info"]
|
|
46
|
+
OpenSSL::X509::Certificate.new(pem.gsub(/\A'/,"").gsub(/'\z/,""))
|
|
47
|
+
end.sort_by do |cert|
|
|
48
|
+
[cert.subject.to_a.sort, -cert.serial.to_i]
|
|
49
|
+
end.each do |cert|
|
|
50
|
+
sj = "#{ OpenSSL::X509::Name.new(cert.subject.to_a.sort) } - #{cert.serial.to_i}"
|
|
51
|
+
fd.write "\n#{ sj }\n#{ "=" * sj.length }\n#{ cert.to_pem }\n"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
fd.string
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def remove_comments(filecontent)
|
|
58
|
+
filecontent.gsub(/^##.*$/, "")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def ==(other)
|
|
62
|
+
remove_comments(content) == remove_comments(other.content)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build # Use for: Build, Runtime
|
|
3
|
+
module Colors
|
|
4
|
+
# Start an escape sequence
|
|
5
|
+
ESC = "\e["
|
|
6
|
+
|
|
7
|
+
# End the escape sequence
|
|
8
|
+
NND = "#{ESC}0m"
|
|
9
|
+
|
|
10
|
+
ColorMap = {
|
|
11
|
+
black: 0,
|
|
12
|
+
red: 1,
|
|
13
|
+
green: 2,
|
|
14
|
+
yellow: 3,
|
|
15
|
+
blue: 4,
|
|
16
|
+
magenta: 5,
|
|
17
|
+
cyan: 6,
|
|
18
|
+
white: 7,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ColorMap.each do |color, code|
|
|
22
|
+
define_method(color) do |string|
|
|
23
|
+
colored(code, string)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def colored(color, string)
|
|
28
|
+
if @colors_on
|
|
29
|
+
c = ColorMap[color] || color
|
|
30
|
+
"#{ESC}#{30+c}m#{string}#{NND}"
|
|
31
|
+
else
|
|
32
|
+
string.dup
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def enable_colors
|
|
37
|
+
@colors_on = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def disable_colors
|
|
41
|
+
@colors_on = false
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build # Use for: Build, Runtime
|
|
3
|
+
module Components
|
|
4
|
+
class Msys2 < Base
|
|
5
|
+
def description
|
|
6
|
+
"MSYS2 base installation"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def needed?
|
|
10
|
+
begin
|
|
11
|
+
if msys.with_msys_apps_enabled(if_no_msys: :raise) { run_verbose("sh", "-lc", "true") }
|
|
12
|
+
puts "MSYS2 seems to be " + green("properly installed")
|
|
13
|
+
false
|
|
14
|
+
else
|
|
15
|
+
true
|
|
16
|
+
end
|
|
17
|
+
rescue Msys2Installation::MsysNotFound
|
|
18
|
+
puts "MSYS2 seems to be " + red("unavailable")
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def execute(args)
|
|
24
|
+
require "open-uri"
|
|
25
|
+
|
|
26
|
+
uri = msys2_download_uri
|
|
27
|
+
filename = File.basename(uri)
|
|
28
|
+
temp_path = File.join(ENV["TMP"] || ENV["TEMP"] || ENV["USERPROFILE"] || "C:/", filename)
|
|
29
|
+
|
|
30
|
+
until check_hash(temp_path, msys2_download_hash)
|
|
31
|
+
puts "Download #{yellow(uri)}\n to #{yellow(temp_path)}"
|
|
32
|
+
File.open(temp_path, "wb") do |fd|
|
|
33
|
+
progress = 0
|
|
34
|
+
total = 0
|
|
35
|
+
params = {
|
|
36
|
+
"Accept-Encoding" => 'identity',
|
|
37
|
+
:content_length_proc => lambda{|length| total = length },
|
|
38
|
+
:progress_proc => lambda{|bytes|
|
|
39
|
+
new_progress = (bytes * 100) / total
|
|
40
|
+
print "\rDownloading %s (%3d%%) " % [filename, new_progress]
|
|
41
|
+
progress = new_progress
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
OpenURI.open_uri(uri, params) do |io|
|
|
45
|
+
fd << io.read
|
|
46
|
+
end
|
|
47
|
+
puts
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
puts "Run the MSYS2 installer ..."
|
|
52
|
+
if run_verbose(temp_path) && msys.with_msys_apps_enabled { run_verbose("sh", "-lc", "true") }
|
|
53
|
+
puts green(" Success")
|
|
54
|
+
else
|
|
55
|
+
puts red(" Failed")
|
|
56
|
+
raise "MSYS2 installer failed"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
MSYS2_VERSION = ENV['MSYS2_VERSION'] || "20190524"
|
|
63
|
+
MSYS2_URI = "http://repo.msys2.org/distrib/<arch>/msys2-<arch>-#{MSYS2_VERSION}.exe"
|
|
64
|
+
|
|
65
|
+
MSYS2_I686_SHA256 = "c5a1881f7ac5a0449fe9b30d3140111a88072727f510c4a66bfa905f8c78e839"
|
|
66
|
+
MSYS2_X86_64_SHA256 = "2dacadcc70cc122054e60914cbc6b689f685bef5713915a90f4185dd9da7954e"
|
|
67
|
+
|
|
68
|
+
def msys2_download_uri
|
|
69
|
+
arch = RUBY_PLATFORM=~/x64/ ? "x86_64" : "i686"
|
|
70
|
+
MSYS2_URI.gsub(/<arch>/, arch)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def msys2_download_hash
|
|
74
|
+
case RUBY_PLATFORM
|
|
75
|
+
when /x64/ then MSYS2_X86_64_SHA256
|
|
76
|
+
else MSYS2_I686_SHA256
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def check_hash(path, hash)
|
|
81
|
+
if ENV['MSYS2_VERSION']
|
|
82
|
+
true
|
|
83
|
+
elsif !File.exist?(path)
|
|
84
|
+
false
|
|
85
|
+
else
|
|
86
|
+
require "digest"
|
|
87
|
+
|
|
88
|
+
print "Verify integrity of #{File.basename(path)} ..."
|
|
89
|
+
res = Digest::SHA256.file(path).hexdigest == hash.downcase
|
|
90
|
+
puts(res ? green(" OK") : red(" Failed"))
|
|
91
|
+
res
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build # Use for: Build, Runtime
|
|
3
|
+
module Components
|
|
4
|
+
class PacmanUpdate < Base
|
|
5
|
+
def self.depends
|
|
6
|
+
%w[msys2]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def description
|
|
10
|
+
"MSYS2 system update (optional)"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def execute(args)
|
|
14
|
+
msys.with_msys_apps_enabled do
|
|
15
|
+
puts "Remove catgets to avoid conflicts while update ..."
|
|
16
|
+
# See https://github.com/Alexpux/MSYS2-packages/issues/1141
|
|
17
|
+
run_verbose("pacman", "-Rdd", "catgets", "libcatgets", "--noconfirm")
|
|
18
|
+
|
|
19
|
+
puts "#{description} part 1 ..."
|
|
20
|
+
# Update the package database and core system packages
|
|
21
|
+
res = run_verbose("pacman", "-Syu", *pacman_args)
|
|
22
|
+
puts "#{description} #{res ? green("succeeded") : red("failed")}"
|
|
23
|
+
raise "pacman failed" unless res
|
|
24
|
+
|
|
25
|
+
# Update the rest
|
|
26
|
+
puts "#{description} part 2 ..."
|
|
27
|
+
res = run_verbose("pacman", "-Su", *pacman_args)
|
|
28
|
+
puts "#{description} #{res ? green("succeeded") : red("failed")}"
|
|
29
|
+
raise "pacman failed" unless res
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build # Use for: Build, Runtime
|
|
3
|
+
module Components
|
|
4
|
+
class DevTools < Base
|
|
5
|
+
def self.depends
|
|
6
|
+
%w[msys2]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def description
|
|
10
|
+
"MSYS2 and MINGW development toolchain"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
PACKAGES = %w[
|
|
14
|
+
autoconf
|
|
15
|
+
autoconf2.13
|
|
16
|
+
autogen
|
|
17
|
+
automake-wrapper
|
|
18
|
+
automake1.10
|
|
19
|
+
automake1.11
|
|
20
|
+
automake1.12
|
|
21
|
+
automake1.13
|
|
22
|
+
automake1.14
|
|
23
|
+
automake1.15
|
|
24
|
+
automake1.6
|
|
25
|
+
automake1.7
|
|
26
|
+
automake1.8
|
|
27
|
+
automake1.9
|
|
28
|
+
diffutils
|
|
29
|
+
file
|
|
30
|
+
gawk
|
|
31
|
+
grep
|
|
32
|
+
libtool
|
|
33
|
+
m4
|
|
34
|
+
make
|
|
35
|
+
patch
|
|
36
|
+
pkg-config
|
|
37
|
+
sed
|
|
38
|
+
texinfo
|
|
39
|
+
texinfo-tex
|
|
40
|
+
wget
|
|
41
|
+
mingw-w64-binutils
|
|
42
|
+
mingw-w64-crt-git
|
|
43
|
+
mingw-w64-gcc
|
|
44
|
+
mingw-w64-gcc-libs
|
|
45
|
+
mingw-w64-headers-git
|
|
46
|
+
mingw-w64-libmangle-git
|
|
47
|
+
mingw-w64-libwinpthread-git
|
|
48
|
+
mingw-w64-make
|
|
49
|
+
mingw-w64-pkg-config
|
|
50
|
+
mingw-w64-tools-git
|
|
51
|
+
mingw-w64-winpthreads-git
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
def execute(args)
|
|
55
|
+
msys.with_msys_apps_enabled do
|
|
56
|
+
puts "Install #{description} ..."
|
|
57
|
+
packages = PACKAGES.map do |package|
|
|
58
|
+
package.sub(/^mingw-w64/, msys.mingw_package_prefix)
|
|
59
|
+
end
|
|
60
|
+
res = run_verbose("pacman", "-S", *pacman_args, *packages)
|
|
61
|
+
puts "Install #{description} #{res ? green("succeeded") : red("failed")}"
|
|
62
|
+
raise "pacman failed" unless res
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module RubyInstaller
|
|
2
|
+
module Build # Use for: Build, Runtime
|
|
3
|
+
module Components
|
|
4
|
+
class Base < Rake::Task
|
|
5
|
+
include Colors
|
|
6
|
+
|
|
7
|
+
attr_accessor :task_index
|
|
8
|
+
attr_writer :msys
|
|
9
|
+
attr_accessor :pacman_args
|
|
10
|
+
|
|
11
|
+
def self.depends
|
|
12
|
+
[]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(*_)
|
|
16
|
+
@msys = nil
|
|
17
|
+
enable_colors
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def msys
|
|
22
|
+
@msys ||= BuildOrRuntime.msys2_installation
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# This is extracted from https://github.com/larskanis/shellwords
|
|
26
|
+
def shell_escape(str)
|
|
27
|
+
str = str.to_s
|
|
28
|
+
|
|
29
|
+
# An empty argument will be skipped, so return empty quotes.
|
|
30
|
+
return '""' if str.empty?
|
|
31
|
+
|
|
32
|
+
str = str.dup
|
|
33
|
+
|
|
34
|
+
str.gsub!(/((?:\\)*)"/){ "\\" * ($1.length*2) + "\\\"" }
|
|
35
|
+
if str =~ /\s/
|
|
36
|
+
str.gsub!(/(\\+)\z/){ "\\" * ($1.length*2) }
|
|
37
|
+
str = "\"#{str}\""
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
return str
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def shell_join(array)
|
|
44
|
+
array.map { |arg| shell_escape(arg) }.join(' ')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def run_verbose(*args)
|
|
48
|
+
puts "> #{ cyan(shell_join(args)) }"
|
|
49
|
+
system(*args)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def puts(*args)
|
|
53
|
+
$stderr.puts *args
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "rake"
|
|
2
|
+
|
|
3
|
+
module RubyInstaller
|
|
4
|
+
module Build # Use for: Build, Runtime
|
|
5
|
+
class ComponentsInstaller < Rake::Application
|
|
6
|
+
attr_reader :installable_components
|
|
7
|
+
attr_accessor :msys
|
|
8
|
+
attr_accessor :pacman_args
|
|
9
|
+
|
|
10
|
+
def initialize(msys: nil, pacman_args: ["--needed", "--noconfirm"])
|
|
11
|
+
super()
|
|
12
|
+
@msys = msys
|
|
13
|
+
@pacman_args = pacman_args
|
|
14
|
+
|
|
15
|
+
@task_consts = Dir[File.expand_path("../components/??_*.rb", __FILE__)].sort.map do |comppath|
|
|
16
|
+
require comppath
|
|
17
|
+
|
|
18
|
+
idx, tname = File.basename(comppath, ".rb").split("_", 2)
|
|
19
|
+
const_name = tname.sub(/^[a-z\d]*/) { |match| match.capitalize }
|
|
20
|
+
.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
|
|
21
|
+
[idx.to_i, tname, Components.const_get(const_name)]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
define_tasks
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def reload
|
|
28
|
+
clear
|
|
29
|
+
define_tasks
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def install(component_names)
|
|
33
|
+
collect_command_line_tasks(component_names)
|
|
34
|
+
top_level
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def define_tasks
|
|
40
|
+
@installable_components = @task_consts.map do |idx, tname, task_const|
|
|
41
|
+
t = define_task(task_const, tname => task_const.depends)
|
|
42
|
+
t.task_index = idx
|
|
43
|
+
t.msys = msys
|
|
44
|
+
t.pacman_args = pacman_args
|
|
45
|
+
t
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Do nothing if nothing is requested
|
|
49
|
+
define_task(Rake::Task, :default)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|