tiny_tds 2.1.5-x64-mingw32 → 2.1.7-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +409 -0
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +10 -1
  5. data/Gemfile +0 -7
  6. data/README.md +2 -4
  7. data/Rakefile +19 -10
  8. data/VERSION +1 -1
  9. data/docker-compose.yml +19 -7
  10. data/ext/tiny_tds/client.c +2 -0
  11. data/ext/tiny_tds/extconf.rb +21 -2
  12. data/ext/tiny_tds/extconsts.rb +1 -1
  13. data/ext/tiny_tds/result.c +1 -0
  14. data/lib/tiny_tds/2.4/tiny_tds.so +0 -0
  15. data/lib/tiny_tds/2.5/tiny_tds.so +0 -0
  16. data/lib/tiny_tds/2.6/tiny_tds.so +0 -0
  17. data/lib/tiny_tds/2.7/tiny_tds.so +0 -0
  18. data/lib/tiny_tds/3.0/tiny_tds.so +0 -0
  19. data/lib/tiny_tds/gem.rb +1 -6
  20. data/ports/x64-mingw32/freetds/1.1.24/bin/bsqldb.exe +0 -0
  21. data/ports/x64-mingw32/freetds/1.1.24/bin/datacopy.exe +0 -0
  22. data/ports/x64-mingw32/freetds/1.1.24/bin/defncopy.exe +0 -0
  23. data/ports/x64-mingw32/freetds/1.1.24/bin/freebcp.exe +0 -0
  24. data/ports/x64-mingw32/freetds/1.1.24/bin/libct-4.dll +0 -0
  25. data/ports/x64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll +0 -0
  26. data/ports/x64-mingw32/freetds/1.1.24/bin/tdspool.exe +0 -0
  27. data/ports/x64-mingw32/freetds/1.1.24/bin/tsql.exe +0 -0
  28. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/freetds/1.1.24/lib/libct.dll.a +0 -0
  29. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/freetds/1.1.24/lib/libct.la +2 -2
  30. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/freetds/1.1.24/lib/libsybdb.dll.a +0 -0
  31. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/freetds/1.1.24/lib/libsybdb.la +2 -2
  32. data/ports/x64-mingw32/libiconv/1.15/bin/iconv.exe +0 -0
  33. data/ports/x64-mingw32/libiconv/1.15/bin/libcharset-1.dll +0 -0
  34. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/bin/libiconv-2.dll +0 -0
  35. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/lib/libcharset.dll.a +0 -0
  36. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/lib/libcharset.la +2 -2
  37. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/lib/libiconv.dll.a +0 -0
  38. data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/lib/libiconv.la +2 -2
  39. data/ports/x64-mingw32/openssl/1.1.1s/bin/c_rehash +251 -0
  40. data/ports/x64-mingw32/openssl/1.1.1s/bin/libcrypto-1_1-x64.dll +0 -0
  41. data/ports/x64-mingw32/openssl/1.1.1s/bin/libssl-1_1-x64.dll +0 -0
  42. data/ports/x64-mingw32/openssl/1.1.1s/bin/openssl.exe +0 -0
  43. data/ports/x64-mingw32/openssl/1.1.1s/lib/libcrypto.a +0 -0
  44. data/ports/{x86_64-w64-mingw32/openssl/1.1.1d → x64-mingw32/openssl/1.1.1s}/lib/libcrypto.dll.a +0 -0
  45. data/ports/x64-mingw32/openssl/1.1.1s/lib/libssl.a +0 -0
  46. data/ports/{x86_64-w64-mingw32/openssl/1.1.1d → x64-mingw32/openssl/1.1.1s}/lib/libssl.dll.a +0 -0
  47. data/setup_cimgruby_dev.sh +25 -0
  48. data/start_dev.sh +21 -0
  49. data/tasks/native_gem.rake +15 -6
  50. data/tasks/ports/libiconv.rb +0 -17
  51. data/tasks/ports/recipe.rb +16 -4
  52. data/tasks/ports.rake +58 -35
  53. data/test/bin/install-mssql.ps1 +31 -0
  54. data/test/bin/install-mssqltools.sh +9 -0
  55. data/test/bin/setup_tinytds_db.sh +7 -0
  56. data/test/bin/setup_volume_permissions.sh +10 -0
  57. data/test/client_test.rb +6 -6
  58. data/test/gem_test.rb +11 -13
  59. data/test/sql/db-create.sql +18 -0
  60. data/test/sql/db-login.sql +38 -0
  61. data/test/test_helper.rb +16 -7
  62. data/tiny_tds.gemspec +7 -6
  63. metadata +69 -50
  64. data/.travis.yml +0 -25
  65. data/appveyor.yml +0 -72
  66. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/bsqldb.exe +0 -0
  67. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/datacopy.exe +0 -0
  68. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/defncopy.exe +0 -0
  69. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/freebcp.exe +0 -0
  70. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libct-4.dll +0 -0
  71. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll +0 -0
  72. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tdspool.exe +0 -0
  73. data/ports/x86_64-w64-mingw32/freetds/1.1.24/bin/tsql.exe +0 -0
  74. data/ports/x86_64-w64-mingw32/libiconv/1.15/bin/iconv.exe +0 -0
  75. data/ports/x86_64-w64-mingw32/libiconv/1.15/bin/libcharset-1.dll +0 -0
  76. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/c_rehash +0 -232
  77. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libcrypto-1_1-x64.dll +0 -0
  78. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/libssl-1_1-x64.dll +0 -0
  79. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/bin/openssl.exe +0 -0
  80. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libcrypto.a +0 -0
  81. data/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib/libssl.a +0 -0
  82. data/test/appveyor/dbsetup.ps1 +0 -27
  83. data/test/appveyor/dbsetup.sql +0 -9
  84. data/test/bin/setup.sh +0 -19
  85. /data/ports/{x86_64-w64-mingw32 → x64-mingw32}/freetds/1.1.24/bin/osql +0 -0
  86. /data/ports/{x86_64-w64-mingw32 → x64-mingw32}/libiconv/1.15/lib/charset.alias +0 -0
@@ -17,7 +17,7 @@ old_library=''
17
17
  inherited_linker_flags=''
18
18
 
19
19
  # Libraries that this one depends upon.
20
- dependency_libs=' -R/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib -lws2_32 -lssl -lcrypto /Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.la'
20
+ dependency_libs=' -R/root/project/ports/x64-mingw32/libiconv/1.15/lib -L/root/project/ports/x64-mingw32/libiconv/1.15/lib -L/root/project/ports/x64-mingw32/openssl/1.1.1s/lib -lws2_32 -lssl -lcrypto /root/project/ports/x64-mingw32/libiconv/1.15/lib/libiconv.la'
21
21
 
22
22
  # Names of additional weak libraries provided by this library
23
23
  weak_library_names=''
@@ -38,4 +38,4 @@ dlopen=''
38
38
  dlpreopen=''
39
39
 
40
40
  # Directory that this library needs to be installed in:
41
- libdir='/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/freetds/1.1.24/lib'
41
+ libdir='/root/project/ports/x64-mingw32/freetds/1.1.24/lib'
@@ -17,7 +17,7 @@ old_library=''
17
17
  inherited_linker_flags=''
18
18
 
19
19
  # Libraries that this one depends upon.
20
- dependency_libs=' -R/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib -lws2_32 -lssl -lcrypto /Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib/libiconv.la'
20
+ dependency_libs=' -R/root/project/ports/x64-mingw32/libiconv/1.15/lib -L/root/project/ports/x64-mingw32/libiconv/1.15/lib -L/root/project/ports/x64-mingw32/openssl/1.1.1s/lib -lws2_32 -lssl -lcrypto /root/project/ports/x64-mingw32/libiconv/1.15/lib/libiconv.la'
21
21
 
22
22
  # Names of additional weak libraries provided by this library
23
23
  weak_library_names=''
@@ -38,4 +38,4 @@ dlopen=''
38
38
  dlpreopen=''
39
39
 
40
40
  # Directory that this library needs to be installed in:
41
- libdir='/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/freetds/1.1.24/lib'
41
+ libdir='/root/project/ports/x64-mingw32/freetds/1.1.24/lib'
@@ -17,7 +17,7 @@ old_library=''
17
17
  inherited_linker_flags=''
18
18
 
19
19
  # Libraries that this one depends upon.
20
- dependency_libs=' -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib'
20
+ dependency_libs=' -L/root/project/ports/x64-mingw32/openssl/1.1.1s/lib'
21
21
 
22
22
  # Names of additional weak libraries provided by this library
23
23
  weak_library_names=''
@@ -38,4 +38,4 @@ dlopen=''
38
38
  dlpreopen=''
39
39
 
40
40
  # Directory that this library needs to be installed in:
41
- libdir='/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib'
41
+ libdir='/root/project/ports/x64-mingw32/libiconv/1.15/lib'
@@ -17,7 +17,7 @@ old_library=''
17
17
  inherited_linker_flags=''
18
18
 
19
19
  # Libraries that this one depends upon.
20
- dependency_libs=' -L/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/openssl/1.1.1d/lib'
20
+ dependency_libs=' -L/root/project/ports/x64-mingw32/openssl/1.1.1s/lib'
21
21
 
22
22
  # Names of additional weak libraries provided by this library
23
23
  weak_library_names=''
@@ -38,4 +38,4 @@ dlopen=''
38
38
  dlpreopen=''
39
39
 
40
40
  # Directory that this library needs to be installed in:
41
- libdir='/Users/bvogelzang/Documents/tiny_tds/ports/x86_64-w64-mingw32/libiconv/1.15/lib'
41
+ libdir='/root/project/ports/x64-mingw32/libiconv/1.15/lib'
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env perl
2
+
3
+ # WARNING: do not edit!
4
+ # Generated by Makefile from tools/c_rehash.in
5
+ # Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
6
+ #
7
+ # Licensed under the OpenSSL license (the "License"). You may not use
8
+ # this file except in compliance with the License. You can obtain a copy
9
+ # in the file LICENSE in the source distribution or at
10
+ # https://www.openssl.org/source/license.html
11
+
12
+ # Perl c_rehash script, scan all files in a directory
13
+ # and add symbolic links to their hash values.
14
+
15
+ my $dir = "/root/project/ports/x64-mingw32/openssl/1.1.1s";
16
+ my $prefix = "/root/project/ports/x64-mingw32/openssl/1.1.1s";
17
+
18
+ my $errorcount = 0;
19
+ my $openssl = $ENV{OPENSSL} || "openssl";
20
+ my $pwd;
21
+ my $x509hash = "-subject_hash";
22
+ my $crlhash = "-hash";
23
+ my $verbose = 0;
24
+ my $symlink_exists=eval {symlink("",""); 1};
25
+ my $removelinks = 1;
26
+
27
+ ## Parse flags.
28
+ while ( $ARGV[0] =~ /^-/ ) {
29
+ my $flag = shift @ARGV;
30
+ last if ( $flag eq '--');
31
+ if ( $flag eq '-old') {
32
+ $x509hash = "-subject_hash_old";
33
+ $crlhash = "-hash_old";
34
+ } elsif ( $flag eq '-h' || $flag eq '-help' ) {
35
+ help();
36
+ } elsif ( $flag eq '-n' ) {
37
+ $removelinks = 0;
38
+ } elsif ( $flag eq '-v' ) {
39
+ $verbose++;
40
+ }
41
+ else {
42
+ print STDERR "Usage error; try -h.\n";
43
+ exit 1;
44
+ }
45
+ }
46
+
47
+ sub help {
48
+ print "Usage: c_rehash [-old] [-h] [-help] [-v] [dirs...]\n";
49
+ print " -old use old-style digest\n";
50
+ print " -h or -help print this help text\n";
51
+ print " -v print files removed and linked\n";
52
+ exit 0;
53
+ }
54
+
55
+ eval "require Cwd";
56
+ if (defined(&Cwd::getcwd)) {
57
+ $pwd=Cwd::getcwd();
58
+ } else {
59
+ $pwd=`pwd`;
60
+ chomp($pwd);
61
+ }
62
+
63
+ # DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
64
+ my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
65
+ $ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
66
+
67
+ if (! -x $openssl) {
68
+ my $found = 0;
69
+ foreach (split /$path_delim/, $ENV{PATH}) {
70
+ if (-x "$_/$openssl") {
71
+ $found = 1;
72
+ $openssl = "$_/$openssl";
73
+ last;
74
+ }
75
+ }
76
+ if ($found == 0) {
77
+ print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n";
78
+ exit 0;
79
+ }
80
+ }
81
+
82
+ if (@ARGV) {
83
+ @dirlist = @ARGV;
84
+ } elsif ($ENV{SSL_CERT_DIR}) {
85
+ @dirlist = split /$path_delim/, $ENV{SSL_CERT_DIR};
86
+ } else {
87
+ $dirlist[0] = "$dir/certs";
88
+ }
89
+
90
+ if (-d $dirlist[0]) {
91
+ chdir $dirlist[0];
92
+ $openssl="$pwd/$openssl" if (!-x $openssl);
93
+ chdir $pwd;
94
+ }
95
+
96
+ foreach (@dirlist) {
97
+ if (-d $_ ) {
98
+ if ( -w $_) {
99
+ hash_dir($_);
100
+ } else {
101
+ print "Skipping $_, can't write\n";
102
+ $errorcount++;
103
+ }
104
+ }
105
+ }
106
+ exit($errorcount);
107
+
108
+ sub copy_file {
109
+ my ($src_fname, $dst_fname) = @_;
110
+
111
+ if (open(my $in, "<", $src_fname)) {
112
+ if (open(my $out, ">", $dst_fname)) {
113
+ print $out $_ while (<$in>);
114
+ close $out;
115
+ } else {
116
+ warn "Cannot open $dst_fname for write, $!";
117
+ }
118
+ close $in;
119
+ } else {
120
+ warn "Cannot open $src_fname for read, $!";
121
+ }
122
+ }
123
+
124
+ sub hash_dir {
125
+ my $dir = shift;
126
+ my %hashlist;
127
+
128
+ print "Doing $dir\n";
129
+
130
+ if (!chdir $dir) {
131
+ print STDERR "WARNING: Cannot chdir to '$dir', $!\n";
132
+ return;
133
+ }
134
+
135
+ opendir(DIR, ".") || print STDERR "WARNING: Cannot opendir '.', $!\n";
136
+ my @flist = sort readdir(DIR);
137
+ closedir DIR;
138
+ if ( $removelinks ) {
139
+ # Delete any existing symbolic links
140
+ foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
141
+ if (-l $_) {
142
+ print "unlink $_\n" if $verbose;
143
+ unlink $_ || warn "Can't unlink $_, $!\n";
144
+ }
145
+ }
146
+ }
147
+ FILE: foreach $fname (grep {/\.(pem)|(crt)|(cer)|(crl)$/} @flist) {
148
+ # Check to see if certificates and/or CRLs present.
149
+ my ($cert, $crl) = check_file($fname);
150
+ if (!$cert && !$crl) {
151
+ print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
152
+ next;
153
+ }
154
+ link_hash_cert($fname) if ($cert);
155
+ link_hash_crl($fname) if ($crl);
156
+ }
157
+
158
+ chdir $pwd;
159
+ }
160
+
161
+ sub check_file {
162
+ my ($is_cert, $is_crl) = (0,0);
163
+ my $fname = $_[0];
164
+
165
+ open(my $in, "<", $fname);
166
+ while(<$in>) {
167
+ if (/^-----BEGIN (.*)-----/) {
168
+ my $hdr = $1;
169
+ if ($hdr =~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
170
+ $is_cert = 1;
171
+ last if ($is_crl);
172
+ } elsif ($hdr eq "X509 CRL") {
173
+ $is_crl = 1;
174
+ last if ($is_cert);
175
+ }
176
+ }
177
+ }
178
+ close $in;
179
+ return ($is_cert, $is_crl);
180
+ }
181
+
182
+ sub compute_hash {
183
+ my $fh;
184
+ if ( $^O eq "VMS" ) {
185
+ # VMS uses the open through shell
186
+ # The file names are safe there and list form is unsupported
187
+ if (!open($fh, "-|", join(' ', @_))) {
188
+ print STDERR "Cannot compute hash on '$fname'\n";
189
+ return;
190
+ }
191
+ } else {
192
+ if (!open($fh, "-|", @_)) {
193
+ print STDERR "Cannot compute hash on '$fname'\n";
194
+ return;
195
+ }
196
+ }
197
+ return (<$fh>, <$fh>);
198
+ }
199
+
200
+ # Link a certificate to its subject name hash value, each hash is of
201
+ # the form <hash>.<n> where n is an integer. If the hash value already exists
202
+ # then we need to up the value of n, unless its a duplicate in which
203
+ # case we skip the link. We check for duplicates by comparing the
204
+ # certificate fingerprints
205
+
206
+ sub link_hash_cert {
207
+ link_hash($_[0], 'cert');
208
+ }
209
+
210
+ # Same as above except for a CRL. CRL links are of the form <hash>.r<n>
211
+
212
+ sub link_hash_crl {
213
+ link_hash($_[0], 'crl');
214
+ }
215
+
216
+ sub link_hash {
217
+ my ($fname, $type) = @_;
218
+ my $is_cert = $type eq 'cert';
219
+
220
+ my ($hash, $fprint) = compute_hash($openssl,
221
+ $is_cert ? "x509" : "crl",
222
+ $is_cert ? $x509hash : $crlhash,
223
+ "-fingerprint", "-noout",
224
+ "-in", $fname);
225
+ chomp $hash;
226
+ chomp $fprint;
227
+ return if !$hash;
228
+ $fprint =~ s/^.*=//;
229
+ $fprint =~ tr/://d;
230
+ my $suffix = 0;
231
+ # Search for an unused hash filename
232
+ my $crlmark = $is_cert ? "" : "r";
233
+ while(exists $hashlist{"$hash.$crlmark$suffix"}) {
234
+ # Hash matches: if fingerprint matches its a duplicate cert
235
+ if ($hashlist{"$hash.$crlmark$suffix"} eq $fprint) {
236
+ my $what = $is_cert ? 'certificate' : 'CRL';
237
+ print STDERR "WARNING: Skipping duplicate $what $fname\n";
238
+ return;
239
+ }
240
+ $suffix++;
241
+ }
242
+ $hash .= ".$crlmark$suffix";
243
+ if ($symlink_exists) {
244
+ print "link $fname -> $hash\n" if $verbose;
245
+ symlink $fname, $hash || warn "Can't symlink, $!";
246
+ } else {
247
+ print "copy $fname -> $hash\n" if $verbose;
248
+ copy_file($fname, $hash);
249
+ }
250
+ $hashlist{$hash} = $fprint;
251
+ }
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ # this should mirror the steps outlined in the circleci yml
7
+ echo "Installing mssql-tools..."
8
+ sleep 5
9
+ sudo -E ./test/bin/install-mssqltools.sh
10
+
11
+ echo "Configurating tinytds test database..."
12
+ sleep 5
13
+ ./test/bin/setup_tinytds_db.sh
14
+
15
+ echo "Building openssl library..."
16
+ sleep 5
17
+ sudo -E ./test/bin/install-openssl.sh
18
+
19
+ echo "Building freetds library..."
20
+ sleep 5
21
+ sudo -E ./test/bin/install-freetds.sh
22
+
23
+ echo "Installing gems..."
24
+ sleep 5
25
+ bundle install
data/start_dev.sh ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ # set volume read/write permissions to work both outside and inside container
7
+ sudo ./test/bin/setup_volume_permissions.sh
8
+
9
+ docker-compose up -d
10
+ echo "Waiting for containers to start..."
11
+ sleep 10
12
+
13
+ # setup circleci ruby container for development
14
+ docker exec cimg_ruby bash -c './setup_cimgruby_dev.sh'
15
+
16
+ # enter container
17
+ set +x
18
+ echo "cimg/ruby container is ready for tiny_tds development.........."
19
+ echo "To enter container run: docker exec -it cimg_ruby /bin/bash"
20
+ echo "To build solution run: docker exec cimg_ruby bash -c 'bundle exec rake build'"
21
+ echo "To test solution run: docker exec cimg_ruby bash -c 'bundle exec rake test'"
@@ -1,14 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
- desc 'Build the windows binary gems per rake-compiler-dock'
4
- task 'gem:windows' => ['ports:cross'] do
3
+ desc 'Build the native binary gems using rake-compiler-dock'
4
+ task 'gem:native' => ['ports:cross'] do
5
5
  require 'rake_compiler_dock'
6
6
 
7
7
  # make sure to install our bundle
8
- build = ['bundle']
8
+ sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
9
9
 
10
- # and finally build the native gem
11
- build << 'rake cross native gem RUBY_CC_VERSION=2.7.0:2.6.0:2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"'
10
+ GEM_PLATFORM_HOSTS.each do |plat, meta|
11
+ RakeCompilerDock.sh "bundle --local && RUBY_CC_VERSION=#{meta[:ruby_versions]} rake native:#{plat} gem", platform: plat
12
+ end
13
+ end
14
+
15
+ # assumes you are in a container provided by Rake compiler
16
+ # if not, use the task above
17
+ task 'gem:for_platform', [:gem_platform] do |_task, args|
18
+ args.with_defaults(gem_platform: RbConfig::CONFIG["arch"])
12
19
 
13
- RakeCompilerDock.sh build.join(' && ')
20
+ sh "bundle install"
21
+ Rake::Task["ports:compile"].invoke(GEM_PLATFORM_HOSTS[args.gem_platform][:host], args.gem_platform)
22
+ sh "RUBY_CC_VERSION=#{GEM_PLATFORM_HOSTS[args.gem_platform][:ruby_versions]} rake native:#{args.gem_platform} gem"
14
23
  end
@@ -8,25 +8,8 @@ module Ports
8
8
  set_patches
9
9
  end
10
10
 
11
- def cook
12
- chdir_for_build do
13
- super
14
- end
15
- self
16
- end
17
-
18
11
  private
19
12
 
20
- # When using rake-compiler-dock on Windows, the underlying Virtualbox shared
21
- # folders don't support symlinks, but libiconv expects it for a build on
22
- # Linux. We work around this limitation by using the temp dir for cooking.
23
- def chdir_for_build
24
- build_dir = ENV['RCD_HOST_RUBY_PLATFORM'].to_s =~ /mingw|mswin|cygwin/ ? '/tmp' : '.'
25
- Dir.chdir(build_dir) do
26
- yield
27
- end
28
- end
29
-
30
13
  def configure_defaults
31
14
  [
32
15
  "--host=#{@host}",
@@ -5,17 +5,30 @@ require 'rbconfig'
5
5
 
6
6
  module Ports
7
7
  class Recipe < MiniPortile
8
+ attr_writer :gem_platform
9
+
8
10
  def cook
9
- checkpoint = "ports/#{name}-#{version}-#{host}.installed"
11
+ checkpoint = "ports/checkpoints/#{name}-#{version}-#{gem_platform}.installed"
10
12
 
11
13
  unless File.exist? checkpoint
12
14
  super
15
+ FileUtils.mkdir_p("ports/checkpoints")
13
16
  FileUtils.touch checkpoint
14
17
  end
15
18
  end
16
19
 
17
20
  private
18
21
 
22
+ attr_reader :gem_platform
23
+
24
+ def port_path
25
+ "#{@target}/#{gem_platform}/#{@name}/#{@version}"
26
+ end
27
+
28
+ def tmp_path
29
+ "tmp/#{gem_platform}/ports/#{@name}/#{@version}"
30
+ end
31
+
19
32
  def configure_defaults
20
33
  [
21
34
  "--host=#{@host}",
@@ -38,9 +51,9 @@ module Ports
38
51
 
39
52
  def get_patches(libname, version)
40
53
  patches = []
41
-
54
+
42
55
  patch_path = File.expand_path(
43
- File.join('..','..','..','patches',libname,version),
56
+ File.join('..','..','..','patches',libname,version),
44
57
  __FILE__
45
58
  )
46
59
 
@@ -49,4 +62,3 @@ module Ports
49
62
  end
50
63
  end
51
64
  end
52
-
data/tasks/ports.rake CHANGED
@@ -7,63 +7,69 @@ require_relative 'ports/freetds'
7
7
  require_relative '../ext/tiny_tds/extconsts'
8
8
 
9
9
  namespace :ports do
10
- openssl = Ports::Openssl.new(OPENSSL_VERSION)
11
- libiconv = Ports::Libiconv.new(ICONV_VERSION)
12
- freetds = Ports::Freetds.new(FREETDS_VERSION)
10
+ libraries_to_compile = {
11
+ openssl: Ports::Openssl.new(OPENSSL_VERSION),
12
+ libiconv: Ports::Libiconv.new(ICONV_VERSION),
13
+ freetds: Ports::Freetds.new(FREETDS_VERSION)
14
+ }
13
15
 
14
16
  directory "ports"
15
- CLEAN.include "ports/*mingw32*"
17
+ CLEAN.include "ports/*mingw*"
16
18
  CLEAN.include "ports/*.installed"
17
19
 
18
- task :openssl, [:host] do |task, args|
19
- args.with_defaults(host: RbConfig::CONFIG['host'])
20
+ task :openssl, [:host, :gem_platform] do |_task, args|
21
+ args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
20
22
 
21
- openssl.files = [OPENSSL_SOURCE_URI]
22
- openssl.host = args.host
23
- openssl.cook
24
- openssl.activate
23
+ libraries_to_compile[:openssl].files = [OPENSSL_SOURCE_URI]
24
+ libraries_to_compile[:openssl].host = args.host
25
+ libraries_to_compile[:openssl].gem_platform = args.gem_platform
26
+
27
+ libraries_to_compile[:openssl].cook
28
+ libraries_to_compile[:openssl].activate
25
29
  end
26
30
 
27
- task :libiconv, [:host] do |task, args|
28
- args.with_defaults(host: RbConfig::CONFIG['host'])
31
+ task :libiconv, [:host, :gem_platform] do |_task, args|
32
+ args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
29
33
 
30
- libiconv.files = [ICONV_SOURCE_URI]
31
- libiconv.host = args.host
32
- libiconv.cook
33
- libiconv.activate
34
+ libraries_to_compile[:libiconv].files = [ICONV_SOURCE_URI]
35
+ libraries_to_compile[:libiconv].host = args.host
36
+ libraries_to_compile[:libiconv].gem_platform = args.gem_platform
37
+ libraries_to_compile[:libiconv].cook
38
+ libraries_to_compile[:libiconv].activate
34
39
  end
35
40
 
36
- task :freetds, [:host] do |task, args|
37
- args.with_defaults(host: RbConfig::CONFIG['host'])
41
+ task :freetds, [:host, :gem_platform] do |_task, args|
42
+ args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
38
43
 
39
- freetds.files = [FREETDS_SOURCE_URI]
40
- freetds.host = args.host
44
+ libraries_to_compile[:freetds].files = [FREETDS_SOURCE_URI]
45
+ libraries_to_compile[:freetds].host = args.host
46
+ libraries_to_compile[:freetds].gem_platform = args.gem_platform
41
47
 
42
- if openssl
48
+ if libraries_to_compile[:openssl]
43
49
  # freetds doesn't have an option that will provide an rpath
44
50
  # so we do it manually
45
- ENV['OPENSSL_CFLAGS'] = "-Wl,-rpath -Wl,#{openssl.path}/lib"
51
+ ENV['OPENSSL_CFLAGS'] = "-Wl,-rpath -Wl,#{libraries_to_compile[:openssl].path}/lib"
46
52
  # Add the pkgconfig file with MSYS2'ish path, to prefer our ports build
47
53
  # over MSYS2 system OpenSSL.
48
- ENV['PKG_CONFIG_PATH'] = "#{openssl.path.gsub(/^(\w):/i){"/"+$1.downcase}}/lib/pkgconfig:#{ENV['PKG_CONFIG_PATH']}"
49
- freetds.configure_options << "--with-openssl=#{openssl.path}"
54
+ ENV['PKG_CONFIG_PATH'] = "#{libraries_to_compile[:openssl].path.gsub(/^(\w):/i) { "/" + $1.downcase }}/lib/pkgconfig:#{ENV['PKG_CONFIG_PATH']}"
55
+ libraries_to_compile[:freetds].configure_options << "--with-openssl=#{libraries_to_compile[:openssl].path}"
50
56
  end
51
57
 
52
- if libiconv
53
- freetds.configure_options << "--with-libiconv-prefix=#{libiconv.path}"
58
+ if libraries_to_compile[:libiconv]
59
+ libraries_to_compile[:freetds].configure_options << "--with-libiconv-prefix=#{libraries_to_compile[:libiconv].path}"
54
60
  end
55
61
 
56
- freetds.cook
57
- freetds.activate
62
+ libraries_to_compile[:freetds].cook
63
+ libraries_to_compile[:freetds].activate
58
64
  end
59
65
 
60
- task :compile, [:host] do |task,args|
61
- args.with_defaults(host: RbConfig::CONFIG['host'])
66
+ task :compile, [:host, :gem_platform] do |_task, args|
67
+ args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
62
68
 
63
- puts "Compiling ports for #{args.host}..."
69
+ puts "Compiling ports for #{args.host} (Ruby platform #{args.gem_platform}) ..."
64
70
 
65
- ['openssl','libiconv','freetds'].each do |lib|
66
- Rake::Task["ports:#{lib}"].invoke(args.host)
71
+ libraries_to_compile.keys.each do |lib|
72
+ Rake::Task["ports:#{lib}"].invoke(args.host, args.gem_platform)
67
73
  end
68
74
  end
69
75
 
@@ -72,13 +78,30 @@ namespace :ports do
72
78
  require 'rake_compiler_dock'
73
79
 
74
80
  # build the ports for all our cross compile hosts
75
- GEM_PLATFORM_HOSTS.each do |gem_platform, host|
81
+ GEM_PLATFORM_HOSTS.each do |gem_platform, meta|
76
82
  # make sure to install our bundle
77
83
  build = ['bundle']
78
- build << "rake ports:compile[#{host}] MAKE='make -j`nproc`'"
84
+ build << "RUBY_CC_VERSION=#{meta[:ruby_versions]} rake ports:compile[#{meta[:host]},#{gem_platform}] MAKE='make -j`nproc`'"
79
85
  RakeCompilerDock.sh build.join(' && '), platform: gem_platform
80
86
  end
81
87
  end
88
+
89
+ desc "Notes the actual versions for the compiled ports into a file"
90
+ task "version_file", [:gem_platform] do |_task, args|
91
+ args.with_defaults(gem_platform: RbConfig::CONFIG["arch"])
92
+
93
+ ports_version = {}
94
+
95
+ libraries_to_compile.each do |library, library_recipe|
96
+ ports_version[library] = library_recipe.version
97
+ end
98
+
99
+ ports_version[:platform] = args.gem_platform
100
+
101
+ File.open(".ports_versions", "w") do |f|
102
+ f.write ports_version
103
+ end
104
+ end
82
105
  end
83
106
 
84
107
  desc 'Build ports and activate libraries for the current architecture.'