Skip to content
This repository
Browse code

Build sqlite3_api C extension for cross compilation.

- Still to iron issues with i586-mingw32msvc-gcc and exported symbols
  from SQLite3 library.
  • Loading branch information...
commit f344924fac8e341b66b7358d66310aef7544197b 1 parent e9aa188
Luis Lavena authored December 14, 2008

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. 18  tasks/native.rake
18  tasks/native.rake
... ...
@@ -1,7 +1,23 @@
1 1
 # use rake-compiler for building the extension
2 2
 require 'rake/extensiontask'
3 3
 
4  
-Rake::ExtensionTask.new('sqlite3_api', GEM_SPEC)
  4
+# build sqlite3_api C extension
  5
+Rake::ExtensionTask.new('sqlite3_api', GEM_SPEC) do |ext|
  6
+  # reference to the sqlite3 library
  7
+  sqlite3_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'sqlite3'))
  8
+
  9
+  # automatically add build options to avoid need of manual input
  10
+  if RUBY_PLATFORM =~ /mswin|mingw/ then
  11
+    ext.config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
  12
+  end
  13
+
  14
+  # options for cross compilation
  15
+  if RUBY_PLATFORM !~ /mswin|mingw/ then
  16
+    ext.cross_compile = true
  17
+    ext.cross_platform = 'i386-mswin32'
  18
+    ext.cross_config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
  19
+  end
  20
+end
5 21
 
6 22
 # C wrapper depends on swig file to be generated
7 23
 file 'ext/sqlite3_api/sqlite3_api_wrap.c' => ['ext/sqlite3_api/sqlite3_api.i'] do |t|

0 notes on commit f344924

Please sign in to comment.
Something went wrong with that request. Please try again.