Skip to content

Commit

Permalink
(build:windows) include pre-compiled binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen von Takach committed Nov 10, 2017
1 parent 70362de commit a618ffe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`



Expand Down
32 changes: 21 additions & 11 deletions ext/Rakefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions libuv.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit a618ffe

Please sign in to comment.