1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
require "rake/clean"
require "rake/extensioncompiler"
require "mini_portile"
$recipes = {}
$recipes[:sqlite3] = MiniPortile.new "sqlite3", BINARY_VERSION
$recipes[:sqlite3].files << "http://sqlite.org/sqlite-autoconf-#{URL_VERSION}.tar.gz"
namespace :ports do
directory "ports"
desc "Install port sqlite3 #{$recipes[:sqlite3].version}"
task :sqlite3 => ["ports"] do |t|
recipe = $recipes[:sqlite3]
checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
unless File.exist?(checkpoint)
cflags = "-O2 -DSQLITE_ENABLE_COLUMN_METADATA"
cflags << " -fPIC" if recipe.host.include?("x86_64")
recipe.configure_options << "CFLAGS='#{cflags}'"
recipe.cook
touch checkpoint
end
recipe.activate
end
end
if RUBY_PLATFORM =~ /mingw/
Rake::Task['compile'].prerequisites.unshift "ports:sqlite3"
end
if ENV["USE_MINI_PORTILE"] == "true"
Rake::Task["compile"].prerequisites.unshift "ports:sqlite3"
end
task :cross do
host = ENV.fetch("HOST", Rake::ExtensionCompiler.mingw_host)
$recipes.each do |_, recipe|
recipe.host = host
end
# hook compile task with dependencies
Rake::Task["compile"].prerequisites.unshift "ports:sqlite3"
end
CLOBBER.include("ports")
|