diff options
| author | Tom Black <[email protected]> | 2015-10-07 00:35:17 -0400 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2015-10-07 00:35:17 -0400 |
| commit | be1daebb052a163c77d70cc8c504ba61ce46c949 (patch) | |
| tree | e536d151df36e0e7bd4318d47ae5c248ebdf7cc4 /ext | |
| parent | 96451ab4c3ec65097e2fd47de07e3a297823e88e (diff) | |
| download | ruby2d-be1daebb052a163c77d70cc8c504ba61ce46c949.tar.gz ruby2d-be1daebb052a163c77d70cc8c504ba61ce46c949.zip | |
Add Simple 2D to gem installation
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ruby2d/extconf.rb | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/ext/ruby2d/extconf.rb b/ext/ruby2d/extconf.rb index 96c9eb4..04d9cd6 100644 --- a/ext/ruby2d/extconf.rb +++ b/ext/ruby2d/extconf.rb @@ -12,9 +12,9 @@ def print_errors(errors) puts " #{"== Ruby 2D Installation Errors =============================".bold} - Ruby 2D found some problems and was not installed: + #{"Ruby 2D found some problems and was not installed:".error} - #{errors.join("\n ").error} + #{errors.join("\n ")} #{"============================================================".bold} @@ -28,15 +28,23 @@ $LDFLAGS << ' ' # Mac OS if RUBY_PLATFORM =~ /darwin/ - # if `which simple2d`.empty? && has brew - # brew tap simple2d/tap - # brew install simple2d - # end - + # If Simple 2D not installed if `which simple2d`.empty? - errors << "Simple 2D not found!" - print_errors(errors) - exit + + # If Homebrew not installed, print and quit + if `which brew`.empty? + errors << "Ruby 2D uses a library called Simple 2D." << + "On OS X,this can be installed using Homebrew." << + "Install Homebrew, then try installing this gem again.\n" << + "Learn more at http://brew.sh" + print_errors(errors) + exit + + # Install Simple 2D using Homebrew + else + `brew tap simple2d/tap` + `brew install simple2d` + end end $LDFLAGS << `simple2d --libs` @@ -44,18 +52,27 @@ if RUBY_PLATFORM =~ /darwin/ # Windows elsif RUBY_PLATFORM =~ /mingw/ + puts "Ruby 2D doesn't support windows yet :(" + exit + # Linux else - # if `which simple2d`.empty? - # install simple2d using script - # end + # If Simple 2D not installed + if `which simple2d`.empty? + + errors << "Ruby 2D uses a library called Simple 2D." << + "On Linux, there's a script to make installaton easy.\n" << + "Follow the instructions in the README to get started:" << + " https://github.com/simple2d/simple2d" + print_errors(errors) + exit + end $LDFLAGS << `simple2d --libs` - end -# Remove any newlines in flags +# Remove newlines in flags, they cause problems $LDFLAGS.gsub!(/\n/, ' ') create_makefile('ruby2d/ruby2d') |
