Sha256: 4011adb2c29c2b69833f6d302a0d76914f50740331dff965e76ff21a5dbd6643

Contents?: true

Size: 1.58 KB

Versions: 48

Compression:

Stored size: 1.58 KB

Contents

require 'rake/clean'
require 'rake/extensioncompiler'

# download mysql library and headers
directory "vendor"

file "vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip" => ["vendor"] do |t|
  url = "http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip/from/#{CONNECTOR_MIRROR}/"
  when_writing "downloading #{t.name}" do
    cd File.dirname(t.name) do
      sh "wget -c #{url} || curl -C - -O #{url}"
    end
  end
end

file "vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/mysql.h" => ["vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip"] do |t|
  full_file = File.expand_path(t.prerequisites.last)
  when_writing "creating #{t.name}" do
    cd "vendor" do
      sh "unzip #{full_file} mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/bin/** mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/** mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/lib/**"
    end
    # update file timestamp to avoid Rake perform this extraction again.
    touch t.name
  end
end

# clobber expanded packages
CLOBBER.include("vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32")

# vendor:mysql
task 'vendor:mysql' => ["vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/mysql.h"]

# hook into cross compilation vendored mysql dependency
if RUBY_PLATFORM =~ /mingw|mswin/ then
  Rake::Task['compile'].prerequisites.unshift 'vendor:mysql'
else
  if Rake::Task.tasks.map {|t| t.name }.include? 'cross'
    Rake::Task['cross'].prerequisites.unshift 'vendor:mysql'
  end
end

Version data entries

48 entries across 48 versions & 5 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
mysql2-0.2.19b4 tasks/vendor_mysql.rake
mysql2-0.3.12b4 tasks/vendor_mysql.rake
mysql2-0.2.19b3 tasks/vendor_mysql.rake
mysql2-0.3.12b3 tasks/vendor_mysql.rake
mysql2-0.3.12b2 tasks/vendor_mysql.rake
mysql2-0.2.19b2 tasks/vendor_mysql.rake
mysql2-0.3.12b1 tasks/vendor_mysql.rake
mysql2-0.2.19b1 tasks/vendor_mysql.rake
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/tasks/vendor_mysql.rake
mysql2-sp-0.3.10 tasks/vendor_mysql.rake
solaris-mysql2-0.3.11 tasks/vendor_mysql.rake
mysql2-0.3.11-x86-mswin32-60 tasks/vendor_mysql.rake
mysql2-0.3.11-x86-mingw32 tasks/vendor_mysql.rake
mysql2-0.3.11 tasks/vendor_mysql.rake
mysql2-0.2.18-x86-mswin32-60 tasks/vendor_mysql.rake