Sha256: 951bb8776c6c2fde0aa1d5ead3a8601a9d70fd070ea008ea3fdc0fc2d245423c

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents


require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake'
require 'fileutils'

# require 'rake-compiler'
require 'rake/extensiontask'
# require 'rake/extensiontesttask'


# task "build:native" => [:no_extconf, :native, :build] do
#     file = "pkg/stub-#{`cat VERSION`.chomp}.gem"
#     mv file, "#{file.ext}-i686-linux.gem"
# end


Rake::ExtensionTask.new('stub')

# intended to be called by the gem builder
task :haskell_compile => [:compile] do
  ghc_version='/usr/local/bin/ghc' # FIXME, should be able to pick
  # this out from somewhere
  # write the Includes file
  pwd =`pwd`.strip
  arch_headers = "#{RbConfig::CONFIG['rubyhdrdir']}/#{RbConfig::CONFIG['arch']}"
  lib_dir = RbConfig::CONFIG['libdir']
  headers = RbConfig::CONFIG['rubyhdrdir']
  File.open("#{pwd}/Haskell/Language/Ruby/Hubris/Includes.hs","w") do |file|
    file.write "module Language.Ruby.Hubris.Includes where
extraIncludeDirs = [\"#{headers}\", \"#{arch_headers}\"]"
  end
#  command="cd Haskell; cabal update; cabal install
  #  --extra-include-dirs=#{RbConfig::CONFIG['rubyhdrdir']}
  #  --extra-include-dirs=#{RbConfig::CONFIG['rubyhdrdir']}/#{RbConfig::CONFIG['arch']} --extra-lib-dirs=#{RbConfig::CONFIG['libdir']} --user  --enable-shared  --with-ghc=#{ghc_version}"
  command="cabal update; cd Haskell; cabal install --extra-include-dirs=#{arch_headers} --extra-include-dirs=#{headers} --extra-lib-dirs=#{lib_dir} --user  --enable-shared  --with-ghc=#{ghc_version}"
  result=%x{#{command}}
  raise "ERROR: ran #{command}, got #{result}" unless $?.success? 
end

task :no_extconf do
    $gemspec.extensions = []
end

task :default => :haskell_compile

task :clean do
  FileList[File.expand_path("~/.hubris_cache/*"),
           'lib*.so', 'lib/*.o' ].each do |f|
    File.delete(f) rescue nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hubris-0.0.6 Rakefile