зеркало из https://github.com/github/ruby-gpgme.git
Improved test and compilations task.
This commit is contained in:
Родитель
da7e3d55b0
Коммит
a4dac367a1
|
@ -3,3 +3,4 @@ gpgme_n.*
|
|||
mkmf.log
|
||||
Makefile
|
||||
coverage
|
||||
Gemfile.lock
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -2,3 +2,5 @@ source "http://rubygems.org"
|
|||
|
||||
# Specify your gem's dependencies in gpgme.gemspec
|
||||
gemspec
|
||||
|
||||
gem 'rake'
|
||||
|
|
37
Gemfile.lock
37
Gemfile.lock
|
@ -1,37 +0,0 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
gpgme (1.0.8)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
archive-tar-minitar (0.5.2)
|
||||
columnize (0.3.2)
|
||||
linecache19 (0.5.12)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
minitest (2.1.0)
|
||||
mocha (0.9.12)
|
||||
rcov (0.9.9)
|
||||
ruby-debug-base19 (0.11.25)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby_core_source (0.1.4)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
yard (0.6.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
gpgme!
|
||||
minitest (~> 2.1.0)
|
||||
mocha (~> 0.9.12)
|
||||
rcov (~> 0.9.9)
|
||||
ruby-debug19 (~> 0.11.6)
|
||||
yard (~> 0.6.7)
|
13
Rakefile
13
Rakefile
|
@ -8,17 +8,18 @@ require 'yard'
|
|||
|
||||
desc "Re-compile the extensions"
|
||||
task :compile do
|
||||
FileUtils.rm_f('gpgme_n.bundle')
|
||||
FileUtils.rm_f('gpgme_n.o')
|
||||
FileUtils.rm_f('Makefile')
|
||||
FileUtils.rm_rf('tmp') if File.directory?('tmp')
|
||||
mkdir 'tmp'
|
||||
|
||||
system "ruby extconf.rb"
|
||||
system "make"
|
||||
Dir.chdir('tmp') do
|
||||
system "ruby #{File.dirname(__FILE__)}/ext/gpgme/extconf.rb"
|
||||
system "make"
|
||||
end
|
||||
end
|
||||
|
||||
task :default => [:test]
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
Rake::TestTask.new(:test => :compile) do |t|
|
||||
t.libs << 'test'
|
||||
t.pattern = "test/**/*_test.rb"
|
||||
t.verbose = true
|
||||
|
|
|
@ -1,26 +1,57 @@
|
|||
require 'mkmf'
|
||||
|
||||
unless find_executable('gpgme-config')
|
||||
$stderr.puts("gpgme-config not found")
|
||||
CWD = File.expand_path(File.dirname(__FILE__))
|
||||
PREFIX = "#{CWD}/dst/"
|
||||
|
||||
def sys(*cmd)
|
||||
puts " -- #{cmd.join(' ')}"
|
||||
|
||||
unless ret = xsystem(cmd.join(' '))
|
||||
raise "#{cmd.join(' ')} failed!"
|
||||
end
|
||||
|
||||
ret
|
||||
end
|
||||
|
||||
def build(tgz, *flags)
|
||||
sys("tar xjvf #{tgz}")
|
||||
|
||||
Dir.chdir(File.basename(tgz, '.tar.bz2')) do
|
||||
sys("./configure --prefix=#{PREFIX} --disable-shared --enable-static --with-pic", *flags)
|
||||
sys("make")
|
||||
sys("make install")
|
||||
end
|
||||
end
|
||||
|
||||
libgpg_error_tgz = File.join(CWD, 'libgpg-error-1.10.tar.bz2')
|
||||
libassuan_tgz = File.join(CWD, 'libassuan-2.0.2.tar.bz2')
|
||||
gpgme_tgz = File.join(CWD, 'gpgme-1.3.1.tar.bz2')
|
||||
|
||||
# build deps
|
||||
|
||||
build(libgpg_error_tgz, "--disable-nls")
|
||||
build(libassuan_tgz, "--with-gpg-error-prefix=#{PREFIX}")
|
||||
build(gpgme_tgz, "--with-gpg-error-prefix=#{PREFIX}", "--with-libassuan-prefix=#{PREFIX}")
|
||||
|
||||
# copy gpgme
|
||||
|
||||
|
||||
%w[ libassuan libgpg-error libgpgme ].each do |lib|
|
||||
FileUtils.cp "#{CWD}/dst/lib/#{lib}.a", "#{CWD}/#{lib}_ext.a"
|
||||
end
|
||||
|
||||
$INCFLAGS[0,0] = " -I#{CWD}/dst/include "
|
||||
#$LDFLAGS << " -L#{CWD} "
|
||||
$CFLAGS << " -fPIC "
|
||||
|
||||
# build gpgme extension
|
||||
|
||||
unless have_library 'gpg-error_ext' and have_library 'gpgme_ext' and have_library 'assuan_ext' and have_library 'gpg-error_ext' and have_header 'gpgme.h'
|
||||
STDERR.puts "\n\n"
|
||||
STDERR.puts "*********************************************************"
|
||||
STDERR.puts "********* error compiling and linking libgpgme. *********"
|
||||
STDERR.puts "*********************************************************"
|
||||
exit(1)
|
||||
end
|
||||
|
||||
$CFLAGS += ' ' << `gpgme-config --cflags`.chomp
|
||||
$libs += ' ' << `gpgme-config --libs`.chomp
|
||||
|
||||
checking_for('gpgme >= 1.1.3') do
|
||||
if try_run(<<'End')
|
||||
#include <gpgme.h>
|
||||
#include <stdlib.h>
|
||||
int main (void) {
|
||||
return gpgme_check_version ("1.1.3") == NULL;
|
||||
}
|
||||
End
|
||||
true
|
||||
else
|
||||
$CFLAGS += ' -DRUBY_GPGME_NEED_WORKAROUND_KEYLIST_NEXT'
|
||||
false
|
||||
end
|
||||
end
|
||||
have_func('gpgme_op_export_keys')
|
||||
create_makefile ('gpgme_n')
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|||
s.date = '2011-05-09'
|
||||
s.email = 'ueno@unixuser.org'
|
||||
s.extensions = ['ext/gpgme/extconf.rb']
|
||||
s.files = `git ls-files`.split("\n")
|
||||
s.files = Dir['{lib,ext}/**/*']
|
||||
s.has_rdoc = true
|
||||
s.rubyforge_project = 'ruby-gpgme'
|
||||
s.homepage = 'http://rubyforge.org/projects/ruby-gpgme/'
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
|
||||
# include compiled gpgme_n.bundle
|
||||
tmp_dir = File.join(File.dirname(__FILE__), '..', 'tmp')
|
||||
$:.unshift(tmp_dir) if File.directory?(tmp_dir)
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
require 'minitest/autorun'
|
||||
|
|
Загрузка…
Ссылка в новой задаче