Skip to content

Commit 6a695ee

Browse files
author
Anthony Bargnesi
committed
build libbel on gem install
what is working: - libbel builds using autools - bel gem picks up libbel.so - BEL::Completion api works problems: - make clean doesn't properly clear some build files. this is a problem with the Makefile.am settings in libbel. - requires ragel for gem installation refs OpenBEL#22
1 parent 7aeb7db commit 6a695ee

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@ task :default => :unit
3333

3434
require 'yard'
3535
YARD::Rake::YardocTask.new
36+
37+
FileList['tasks/**/*.rake'].each { |task| import task }
3638
# vim: ts=2 sw=2:
3739
# encoding: utf-8

bel.gemspec

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Gem::Specification.new do |spec|
1010
spec.authors = ['Anthony Bargnesi']
1111
spec.date = %q{2014-01-13}
1212
spec.email = %q{[email protected]}
13-
spec.files = [
14-
Dir.glob('lib/**/*.rb'),
15-
Dir.glob('*.md'),
16-
'LICENSE'
17-
].flatten
13+
spec.files = %w(INSTALL.md INSTALL_RUBY.md LICENSE README.md)
14+
spec.files += Dir.glob("lib/**/*.rb")
15+
spec.files += Dir.glob("ext/**/*.[ch]")
16+
spec.files += Dir.glob("vendor/libbel/{AUTHORS,ChangeLog,COPYING,INSTALL,NEWS,README}")
17+
spec.files += Dir.glob("vendor/libbel/{autogen.sh,configure.ac,Makefile.am}")
18+
spec.files += Dir.glob("vendor/libbel/{src}/*")
1819
spec.executables = Dir.glob('bin/*').map(&File.method(:basename))
1920
spec.homepage = 'https://github.com/OpenBEL/bel.rb'
2021
spec.require_paths = ["lib"]
@@ -32,6 +33,8 @@ Gem::Specification.new do |spec|
3233
spec.required_ruby_version \
3334
= '>= 1.9.2'
3435

36+
spec.extensions << 'ext/bel/extconf.rb'
37+
3538
# runtime
3639
spec.add_dependency 'ffi', '~> 1.9'
3740

ext/bel/extconf.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'mkmf'
2+
3+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
4+
5+
$CFLAGS << " #{ENV["CFLAGS"]}"
6+
$CFLAGS << " -g"
7+
$CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
8+
$CFLAGS << " -Wall -Wno-comment"
9+
10+
if !(MAKE = find_executable('gmake') || find_executable('make'))
11+
abort "ERROR: GNU make is required to build Rugged."
12+
end
13+
14+
CWD = File.expand_path(File.dirname(__FILE__))
15+
LIBBEL_DIR = File.join(CWD, '..', '..', 'vendor', 'libbel')
16+
17+
Dir.chdir(LIBBEL_DIR) do
18+
system("./autogen.sh")
19+
system("./configure")
20+
system("#{MAKE} clean all")
21+
end
22+
23+
# By putting the path to the vendored libbel library at the front of
24+
# $DEFLIBPATH, we can ensure that our bundled version is always used.
25+
$DEFLIBPATH.unshift("#{LIBBEL_DIR}/src/.libs")
26+
dir_config('bel', "#{LIBBEL_DIR}/src/.libs")
27+
28+
unless have_library 'bel'
29+
abort "ERROR: Failed to build libbel"
30+
end
31+
32+
create_makefile("bel/bel")

tasks/ext.rake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'rake/extensiontask'
2+
3+
Rake::ExtensionTask.new('bel')

0 commit comments

Comments
 (0)