@@ -104,19 +104,24 @@ def asplode lib
104
104
libfile = File . expand_path ( File . join ( rpath_dir , 'libmysql.lib' ) )
105
105
file 'libmysql.a' => [ deffile , libfile ] do |t |
106
106
when_writing 'building libmysql.a' do
107
- sh 'dlltool' , '--kill-at' ,
107
+ # Ruby kindly shows us where dllwrap is, but that tool does more than we want.
108
+ # Maybe in the future Ruby could provide RbConfig::CONFIG['DLLTOOL'] directly.
109
+ dlltool = RbConfig ::CONFIG [ 'DLLWRAP' ] . gsub ( 'dllwrap' , 'dlltool' )
110
+ sh dlltool , '--kill-at' ,
108
111
'--dllname' , 'libmysql.dll' ,
109
112
'--output-lib' , 'libmysql.a' ,
110
113
'--input-def' , deffile , libfile
111
114
end
112
115
end
113
116
114
117
Rake ::Task [ 'libmysql.a' ] . invoke
115
-
116
- # Make sure the generated interface library works
117
118
$LOCAL_LIBS << ' ' << 'libmysql.a'
118
- abort "-----\n Cannot find libmysql.a\n ----" unless have_library ( 'libmysql' )
119
- abort "-----\n Cannot link to libmysql.a (my_init)\n ----" unless have_func ( 'my_init' )
119
+
120
+ # Make sure the generated interface library works (if cross-compiling, trust without verifying)
121
+ unless RbConfig ::CONFIG [ 'host_os' ] =~ /mswin|mingw/
122
+ abort "-----\n Cannot find libmysql.a\n ----" unless have_library ( 'libmysql' )
123
+ abort "-----\n Cannot link to libmysql.a (my_init)\n ----" unless have_func ( 'my_init' )
124
+ end
120
125
121
126
# Vendor libmysql.dll
122
127
vendordll = File . expand_path ( '../../../vendor/libmysql.dll' , __FILE__ )
0 commit comments