diff --git a/README.md b/README.md index 2a75759..94a0415 100644 --- a/README.md +++ b/README.md @@ -110,11 +110,11 @@ or ### Prerequisites -* The installation also requires [python 2.x](http://www.python.org/getit/) to be installed and available on the PATH +* The installation on BSD/Linux requires [python 2.x](http://www.python.org/getit/) to be installed and available on the PATH * setting the environmental variable `USE_GLOBAL_LIBUV` will prevent compiling the packaged version. * if you have a compatible `libuv.(so | dylib | dll)` on the PATH already -Windows users will additionally require: +On Windows the GEM ships with a pre-compiled binary. If you would like to build yourself: - A copy of Visual Studio 2017. [Visual Studio Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017) works fine. - Windows 10 SDK @@ -126,6 +126,7 @@ Windows users will additionally require: - If using jRuby then [GCC](http://win-builds.org/stable/) is also required - Setup the paths as described on the gcc page - Add required environmental variable `set LIBRARY_PATH=X:\win-builds-64\lib;X:\win-builds-64\x86_64-w64-mingw32\lib` +- `rake compile` diff --git a/ext/Rakefile b/ext/Rakefile index c70f92b..86b9a43 100644 --- a/ext/Rakefile +++ b/ext/Rakefile @@ -1,18 +1,28 @@ + +require 'fileutils' + if ENV.has_key?('USE_GLOBAL_LIBUV') - exit(0) + exit(0) else - require 'rubygems' - require 'ffi' - require 'rake/clean' - require '../lib/libuv/ext/tasks' + require 'rubygems' + require 'ffi' + require 'rake/clean' + require '../lib/libuv/ext/tasks' - Dir.chdir File.expand_path("../", __FILE__) - Dir.chdir '..' + Dir.chdir File.expand_path("../", __FILE__) + Dir.chdir '..' - task :default => :libuv + task :default => :libuv - desc "Compile libuv from submodule" - task :libuv => ["ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}"] + if FFI::Platform.windows? + task :libuv do + FileUtils.mkdir('ext/libuv/lib') + FileUtils.cp 'ext/libuv.dll', 'ext/libuv/lib/libuv.dll' + end + else + desc "Compile libuv from submodule" + task :libuv => ["ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}"] - CLOBBER.include("ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") + CLOBBER.include("ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") + end end diff --git a/libuv.gemspec b/libuv.gemspec index 43177ff..33b0f50 100644 --- a/libuv.gemspec +++ b/libuv.gemspec @@ -28,6 +28,10 @@ Gem::Specification.new do |gem| gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + if File.exist? 'ext/libuv.dll' + gem.files << 'ext/libuv.dll' + end + # Add the submodule to the gem relative_path = File.expand_path("../", __FILE__) + '/' `git submodule --quiet foreach pwd`.split($\).each do |submodule_path|