Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide RubyInstaller with builtin MSYS2 toolchain #42

Merged
merged 34 commits into from
Jun 28, 2017
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2b9fc28
Add the new package 'rubybundle'
larskanis May 21, 2017
8e190a2
Reuse mingw-ruby-package instead of doing the build twice.
larskanis May 21, 2017
6753e6b
Make the component installer independent to Runtime namespace.
larskanis May 22, 2017
682ffe8
Appveyor: fix copy command
larskanis May 23, 2017
25c194b
Use pacman cache of the main MSYS2 environment
larskanis May 24, 2017
5eaa539
Upload rubybundle as artifact
larskanis May 24, 2017
a015ee5
Allow msys and pacman_args to be passed to components installer.
larskanis May 25, 2017
30834e3
Appveyor: Preserve timestamps to make sure ruby-compile isn't retrigg…
larskanis May 25, 2017
2e8e562
Make mingwarch an instance attribute and set it based on the package …
larskanis May 25, 2017
2bb84fb
Appveyor: Remove broken pkg files from cache
larskanis May 25, 2017
c672998
Build rubybundle 7z-files
larskanis May 26, 2017
c00b621
Remove ruby2.3 from appveyor.
larskanis May 26, 2017
4ea7c04
Fix warning:
larskanis May 26, 2017
def25ad
Remove jekyll from Gemfile
larskanis Jun 4, 2017
449a8c4
Remove Ruby-1.9.3 from the PATH to avoid possible interferences with …
larskanis Jun 4, 2017
4fe03e4
Run rake test without bundler
larskanis Jun 4, 2017
e656290
Tests: Restore the PATH to the one before we change it.
larskanis Jun 4, 2017
62aac44
Merge branch 'master' into rubybundle
larskanis Jun 4, 2017
967b31f
Allow overriding of runtime parameters for Msys2Installation.
larskanis Jun 4, 2017
fe23ed6
Add ruby_bin_dir as param to Msys2Installation.
larskanis Jun 4, 2017
e968f8b
Merge branch 'master' into rubybundle
larskanis Jun 4, 2017
9a3ad19
Do a MSYS2 system update while 'ridk install'
larskanis Jun 4, 2017
986f3e0
Use the components installer for pacman -Su as well.
larskanis Jun 4, 2017
bf3173d
Add a test to gem install nokogiri
larskanis Jun 4, 2017
6072558
Print components output to stderr, so that it is in sync with pacman
larskanis Jun 5, 2017
886a7e5
Remove files created while MSYS init from rubybundle.
larskanis Jun 5, 2017
c0b2c03
Fix dir for files to remove
larskanis Jun 5, 2017
866be16
Remove compile receipt in favour of installing from the ri2 pacman re…
larskanis Jun 18, 2017
fbcf1fd
Msys2Installation: Add with_msys_apps_disabled
larskanis Jun 27, 2017
ed66fb0
Use a bit more strict detection for the ri2 pacman repository
larskanis Jun 27, 2017
488b7b8
rubybundle: Use absolute paths for preparing MSYS installation.
larskanis Jun 28, 2017
18e9f53
rubybundle: Disable system MSYS installation while init of the MSYS
larskanis Jun 28, 2017
9f80c51
rubybundle: Redirect pacman-key errors to popen
larskanis Jun 28, 2017
cb393c1
Tests: Install libxslt with the required architecture.
larskanis Jun 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make mingwarch an instance attribute and set it based on the package …
…architecture
larskanis committed May 26, 2017
commit 2e8e56290af0c11b71fb9563be370edee997bcbb
2 changes: 1 addition & 1 deletion lib/ruby_installer/build/components/base.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ def initialize(*_)
end

def msys
msys ||= BuildOrRuntime.msys2_installation
@msys ||= BuildOrRuntime.msys2_installation
end

# This is extracted from https://github.com/larskanis/shellwords
40 changes: 18 additions & 22 deletions lib/ruby_installer/build/msys2_installation.rb
Original file line number Diff line number Diff line change
@@ -12,11 +12,15 @@ class CommandError < RuntimeError
end

attr_reader :mingwdir
attr_reader :mingwarch
attr_reader :mingw_package_prefix

def initialize(msys_path=nil)
def initialize(msys_path: nil, mingwarch: nil, mingw_package_prefix: nil)
@msys_path = msys_path
@msys_path_fixed = true if msys_path
@mingwdir = nil
@mingwarch = mingwarch || (RUBY_PLATFORM=~/x64/ ? 'mingw64' : 'mingw32')
@mingw_package_prefix = mingw_package_prefix || (RUBY_PLATFORM=~/x64/ ? "mingw-w64-x86_64" : "mingw-w64-i686")
end

def reset_cache
@@ -72,20 +76,12 @@ def msys_bin_path
backslachs( File.join(msys_path, "/usr/bin") )
end

def msystem
RUBY_PLATFORM=~/x64/ ? 'MINGW64' : 'MINGW32'
end

def mingw_bin_path(mingwarch=nil)
backslachs( File.join(msys_path, mingwarch || msystem, "bin") )
def mingw_bin_path
backslachs( File.join(msys_path, mingwarch, "bin") )
end

def mingw_prefix
"/#{msystem.downcase}"
end

def mingw_package_prefix
RUBY_PLATFORM=~/x64/ ? "mingw-w64-x86_64" : "mingw-w64-i686"
"/#{mingwarch}"
end

def enable_dll_search_paths
@@ -112,15 +108,15 @@ def disable_dll_search_paths
backslachs( File.join(RbConfig::TOPDIR, "bin") )
end

private def msys_apps_envvars(mingwarch=nil)
private def msys_apps_envvars
vars = {}
msys_bin = msys_bin_path
mingw_bin = mingw_bin_path(mingwarch)
mingw_bin = mingw_bin_path
ruby_bin = ruby_bin_dir

vars['PATH'] = ruby_bin + ";" + mingw_bin + ";" + msys_bin
vars['RI_DEVKIT'] = msys_path
vars['MSYSTEM'] = (mingwarch || msystem).upcase
vars['MSYSTEM'] = mingwarch.upcase
vars['PKG_CONFIG_PATH'] = "#{mingw_prefix}/lib/pkgconfig:#{mingw_prefix}/share/pkgconfig"
vars['ACLOCAL_PATH'] = "#{mingw_prefix}/share/aclocal:/usr/share/aclocal"
vars['MANPATH'] = "#{mingw_prefix}/share/man"
@@ -146,9 +142,9 @@ def disable_dll_search_paths
end
end

def enable_msys_apps(mingwarch: nil, if_no_msys: :hint, for_gem_install: false)
def enable_msys_apps(if_no_msys: :hint, for_gem_install: false)
vars = with_msys_install_hint(if_no_msys) do
msys_apps_envvars(mingwarch)
msys_apps_envvars
end

changed = false
@@ -171,9 +167,9 @@ def enable_msys_apps(mingwarch: nil, if_no_msys: :hint, for_gem_install: false)
changed
end

def disable_msys_apps(mingwarch: nil, if_no_msys: :hint)
def disable_msys_apps(if_no_msys: :hint)
vars = with_msys_install_hint(if_no_msys) do
msys_apps_envvars(mingwarch)
msys_apps_envvars
end
if path=vars.delete("PATH")
ENV['PATH'] = ENV['PATH'].gsub(path + ";", "")
@@ -183,12 +179,12 @@ def disable_msys_apps(mingwarch: nil, if_no_msys: :hint)
end
end

def with_msys_apps_enabled
changed = enable_msys_apps
def with_msys_apps_enabled(*args)
changed = enable_msys_apps(*args)
begin
yield
ensure
disable_msys_apps if changed
disable_msys_apps(*args) if changed
end
end

2 changes: 1 addition & 1 deletion recipes/msys2/50-install-components.rake
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
cachedir = File.join(Build.msys2_installation.msys_path, "/var/cache/pacman/pkg")

file self.devtools => [self.sandboxdir] do |t|
msys = RubyInstaller::Build::Msys2Installation.new(self.sandboxdir)
msys = RubyInstaller::Build::Msys2Installation.new(msys_path: self.sandboxdir, mingwarch: package.mingwdir, mingw_package_prefix: package.pacman_arch)
msys.with_msys_apps_enabled do
# initialize MSYS2
sh "sh", "-lc", "true"