From 0d31f691ac806521b121101287e99778597007b8 Mon Sep 17 00:00:00 2001 From: Stephen von Takach Date: Sun, 10 Jun 2018 12:59:11 +1000 Subject: [PATCH] (submodule:build) update build process Libuv uses make by preference over GYP --- .travis.yml | 1 - lib/libuv/ext/tasks.rb | 10 ---------- lib/libuv/ext/tasks/mac.rb | 26 ++++++++------------------ lib/libuv/ext/tasks/unix.rb | 30 ++++++++++-------------------- lib/libuv/ext/tasks/win.rb | 10 ++++++++++ lib/libuv/version.rb | 2 +- 6 files changed, 29 insertions(+), 50 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18ebd68..981f569 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ rvm: - ruby-2.3.5 - ruby-2.4.2 - ruby-head - - rubinius-3.86 - rubinius - jruby-9.1.13.0 - jruby-head diff --git a/lib/libuv/ext/tasks.rb b/lib/libuv/ext/tasks.rb index 2b811eb..801645d 100644 --- a/lib/libuv/ext/tasks.rb +++ b/lib/libuv/ext/tasks.rb @@ -14,16 +14,6 @@ def self.x64? system "git", "submodule", "update", "--init" end -file 'ext/libuv/build/gyp' => 'ext/libuv/build' do - result = true - if not File.directory?('ext/libuv/build/gyp') - result = system "git", "clone", "https://chromium.googlesource.com/external/gyp", "ext/libuv/build/gyp" - end - raise 'unable to download gyp' unless result -end - -CLEAN.include('ext/libuv/build/gyp') - if FFI::Platform.windows? require File.join File.expand_path("../", __FILE__), 'tasks/win' elsif FFI::Platform.mac? diff --git a/lib/libuv/ext/tasks/mac.rb b/lib/libuv/ext/tasks/mac.rb index 3577895..ceda755 100644 --- a/lib/libuv/ext/tasks/mac.rb +++ b/lib/libuv/ext/tasks/mac.rb @@ -1,34 +1,24 @@ # frozen_string_literal: true -file 'ext/libuv/uv.xcodeproj' => 'ext/libuv/build/gyp' do - target_arch = 'ia32'if FFI::Platform.ia32? - target_arch = 'x64' if FFI::Platform.x64? - - abort "Don't know how to build on #{FFI::Platform::ARCH} (yet)" unless target_arch - - Dir.chdir("ext/libuv") do |path| - system "./gyp_uv.py -f xcode -Dtarget_arch=#{target_arch} -Duv_library=shared_library -Dcomponent=shared_library" - end -end - -file "ext/libuv/build/Release/libuv.#{FFI::Platform::LIBSUFFIX}" => 'ext/libuv/uv.xcodeproj' do +file "ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}" => 'ext/libuv/build' do Dir.chdir("ext/libuv") do |path| - system 'xcodebuild -project uv.xcodeproj -configuration Release -target libuv' + system "sh", "autogen.sh" + system "./configure" + system "make" end end -file "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}" => "ext/libuv/build/Release/libuv.#{FFI::Platform::LIBSUFFIX}" do +file "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}" => "ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}" do FileUtils.mkdir('ext/libuv/lib') unless File.directory?('ext/libuv/lib') user_lib = "#{ENV['HOME']}/lib" FileUtils.mkdir(user_lib) unless File.directory?(user_lib) # Useful for building other libraries that wish to use Libuv - FileUtils.cp("ext/libuv/build/Release/libuv.#{FFI::Platform::LIBSUFFIX}", "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") + FileUtils.cp("ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}", "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") # Primrary load location - falls back to above if not available - FileUtils.cp("ext/libuv/build/Release/libuv.#{FFI::Platform::LIBSUFFIX}", "#{user_lib}/libuv.#{FFI::Platform::LIBSUFFIX}") + FileUtils.cp("ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}", "#{user_lib}/libuv.#{FFI::Platform::LIBSUFFIX}") end -CLEAN.include('ext/libuv/uv.xcodeproj') -CLOBBER.include("ext/libuv/build/Release/libuv.#{FFI::Platform::LIBSUFFIX}") +CLOBBER.include("ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}") diff --git a/lib/libuv/ext/tasks/unix.rb b/lib/libuv/ext/tasks/unix.rb index 159bdcc..04bbad8 100644 --- a/lib/libuv/ext/tasks/unix.rb +++ b/lib/libuv/ext/tasks/unix.rb @@ -1,30 +1,20 @@ # frozen_string_literal: true -file 'ext/libuv/out' => 'ext/libuv/build/gyp' do - target_arch = 'ia32'if FFI::Platform.ia32? - target_arch = 'x64' if FFI::Platform.x64? - - abort "Don't know how to build on #{FFI::Platform::ARCH} (yet)" unless target_arch - - Dir.chdir("ext/libuv") do |path| - system "./gyp_uv.py -f make -Dtarget_arch=#{target_arch} -Duv_library=shared_library -Dcomponent=shared_library" - end -end - -file "ext/libuv/out/Release/lib.target/libuv.#{FFI::Platform::LIBSUFFIX}" => 'ext/libuv/out' do +file "ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}" => 'ext/libuv/build' do Dir.chdir("ext/libuv") do |path| - system 'make -C out BUILDTYPE=Release' + system "sh", "autogen.sh" + system "./configure" + system "make" end end -file "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}" => "ext/libuv/out/Release/lib.target/libuv.#{FFI::Platform::LIBSUFFIX}" do +file "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}" => "ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}" do FileUtils.mkdir('ext/libuv/lib') unless File.directory?('ext/libuv/lib') - begin - FileUtils.cp("ext/libuv/out/Release/lib.target/libuv.#{FFI::Platform::LIBSUFFIX}", "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") - rescue => e - FileUtils.cp("ext/libuv/out/Release/lib.target/libuv.#{FFI::Platform::LIBSUFFIX}.1", "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") + FileUtils.cp("ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}", "ext/libuv/lib/libuv.#{FFI::Platform::LIBSUFFIX}") + + Dir.chdir("ext/libuv") do |path| + system "make", "install" end end -CLEAN.include('ext/libuv/out') -CLOBBER.include("ext/libuv/out/Release/lib.target/libuv.#{FFI::Platform::LIBSUFFIX}") +CLOBBER.include("ext/libuv/.libs/libuv.1.#{FFI::Platform::LIBSUFFIX}") diff --git a/lib/libuv/ext/tasks/win.rb b/lib/libuv/ext/tasks/win.rb index 3e776e0..34e6311 100644 --- a/lib/libuv/ext/tasks/win.rb +++ b/lib/libuv/ext/tasks/win.rb @@ -1,5 +1,15 @@ # frozen_string_literal: true +file 'ext/libuv/build/gyp' => 'ext/libuv/build' do + result = true + if not File.directory?('ext/libuv/build/gyp') + result = system "git", "clone", "https://chromium.googlesource.com/external/gyp", "ext/libuv/build/gyp" + end + raise 'unable to download gyp' unless result +end + +CLEAN.include('ext/libuv/build/gyp') + file "ext/libuv/Release/libuv.#{FFI::Platform::LIBSUFFIX}" do target_arch = 'ia32' target_arch = 'x64' if FFI::Platform.x64? diff --git a/lib/libuv/version.rb b/lib/libuv/version.rb index 262f57b..45df439 100644 --- a/lib/libuv/version.rb +++ b/lib/libuv/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Libuv - VERSION = '4.0.2' + VERSION = '4.0.3' end