Sha256: 6c1672b05dc14fe27cd5c815747cec1a3d92e228a763eb2b3e9858aa4082423b

Contents?: true

Size: 1.42 KB

Versions: 22

Compression:

Stored size: 1.42 KB

Contents

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

# download mysql library and headers
directory "vendor"

file "vendor/mysql-noinstall-#{MYSQL_VERSION}-win32.zip" => ['vendor'] do |t|
  base_version = MYSQL_VERSION.gsub(/\.[0-9]+$/, '')
  url = "http://dev.mysql.com/get/Downloads/MySQL-#{base_version}/#{File.basename(t.name)}/from/#{MYSQL_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-#{MYSQL_VERSION}-win32/include/mysql.h" => ["vendor/mysql-noinstall-#{MYSQL_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-#{MYSQL_VERSION}-win32/bin/** mysql-#{MYSQL_VERSION}-win32/include/** mysql-#{MYSQL_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-#{MYSQL_VERSION}-win32")

# vendor:mysql
task 'vendor:mysql' => ["vendor/mysql-#{MYSQL_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

22 entries across 22 versions & 7 rubygems

Version Path
fauna-mysql-2.8.1.1 tasks/vendor_mysql.rake
vanity-1.7.1 vendor/ruby/1.9.1/gems/mysql-2.8.1/tasks/vendor_mysql.rake
mysql2-0.2.7 tasks/vendor_mysql.rake
mysql2_bigint-0.2.6.1 tasks/vendor_mysql.rake
ghazel-mysql2-0.2.6.3 tasks/vendor_mysql.rake
ghazel-mysql2-0.2.6.2 tasks/vendor_mysql.rake
ghazel-mysql2-0.2.6.1 tasks/vendor_mysql.rake
fauna-mysql-2.8.1.2 tasks/vendor_mysql.rake
mysql2-0.2.6 tasks/vendor_mysql.rake
mysql2-0.2.6-x86-mswin32-60 tasks/vendor_mysql.rake
mysql2-0.2.6-x86-mingw32 tasks/vendor_mysql.rake
mysql2-0.2.5 tasks/vendor_mysql.rake
mysql2-0.2.4 tasks/vendor_mysql.rake
mysql2-0.2.3 tasks/vendor_mysql.rake
mysql2-0.2.2 tasks/vendor_mysql.rake
mysql2-0.2.1 tasks/vendor_mysql.rake
mysql2-0.2.0 tasks/vendor_mysql.rake
phonet-0.0.1 tasks/vendor_mysql.rake
fauna-mysql-2.8.1.3 tasks/vendor_mysql.rake
mysql-2.8.1-x86-mswin32 tasks/vendor_mysql.rake