Skip to content

Commit 41ab20a

Browse files
committed
Local changes used to cross-compile the 0.3.18 gem
1 parent dd63399 commit 41ab20a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

tasks/compile.rake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
2626

2727
ext.cross_compiling do |spec|
2828
Rake::Task['lib/mysql2/mysql2.rb'].invoke
29+
# vendor/libmysql.dll is invoked from extconf.rb
30+
Rake::Task['vendor/README'].invoke
2931
spec.files << 'lib/mysql2/mysql2.rb'
3032
spec.files << 'vendor/libmysql.dll'
33+
spec.files << 'vendor/README'
3134
spec.post_install_message = <<-POST_INSTALL_MESSAGE
3235
3336
======================================================================================================
@@ -36,12 +39,10 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
3639
It was built using MySQL Connector/C version #{CONNECTOR_VERSION}.
3740
It's recommended to use the exact same version to avoid potential issues.
3841
39-
At the time of building this gem, the necessary DLL files were available
40-
in the following download:
41-
42+
At the time of building this gem, the necessary DLL files were retrieved from:
4243
#{vendor_mysql_url(spec.platform)}
4344
44-
And put lib\\libmysql.dll file in your Ruby bin directory, for example C:\\Ruby\\bin
45+
This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
4546
4647
======================================================================================================
4748
@@ -51,6 +52,13 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
5152
end
5253
Rake::Task[:spec].prerequisites << :compile
5354

55+
file 'vendor/README' do |t|
56+
connector_dir = File.expand_path("../../vendor/#{vendor_mysql_dir}", __FILE__)
57+
when_writing 'copying Connector/C README' do
58+
cp "#{connector_dir}/README", 'vendor/README'
59+
end
60+
end
61+
5462
file 'lib/mysql2/mysql2.rb' do |t|
5563
name = gemspec.name
5664
File.open(t.name, 'wb') do |f|

tasks/vendor_mysql.rake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ task "vendor:mysql", [:platform] do |t, args|
5151
sh "unzip", "-uq", full_file,
5252
"#{vendor_mysql_dir(args[:platform])}/bin/**",
5353
"#{vendor_mysql_dir(args[:platform])}/include/**",
54-
"#{vendor_mysql_dir(args[:platform])}/lib/**"
54+
"#{vendor_mysql_dir(args[:platform])}/lib/**",
55+
"#{vendor_mysql_dir(args[:platform])}/README" # contains the license info
5556
end
56-
# update file timestamp to avoid Rake perform this extraction again.
57+
# update file timestamp to avoid Rake performing this extraction again.
5758
touch t.name
5859
end
5960
end

0 commit comments

Comments
 (0)