tiny_tds 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ebd6b7b9d21919fda9b7981bb8c2fb91bffc30fc52c20af755cf1f4149ecb78
4
- data.tar.gz: 925d9f1495eed1939585a0c413145b1e8917cf7d8ae219a71416f00ad89a7f00
3
+ metadata.gz: da6ec62dafae6c5922693c73e68c96b400d11a01e822dd14cca6dfe895ad73c5
4
+ data.tar.gz: d0cf523d4883812c73380dc9362205cf4129c003f7fe59fa0ec4ddabb6113563
5
5
  SHA512:
6
- metadata.gz: 57653af7ec8f2a4d176ded975ce57c639c326a9ba9270c7fa91b43a2290cb8ab9452047fb79b593b95b59c526317c957628b1f3abc7e5e0935fdd021a3de38ea
7
- data.tar.gz: 0abb0eb0fd59833f4564021123c20efc6b069531f028ac985b6a0ef539652a0530de0750de4ee37512402383686d402ca260986d5fa557d81e47242e15b23178
6
+ metadata.gz: 31a885748fc4baf54c8db55685a21c33bce4c3d5814392b8eda842f793ed5ae1ab32214d0c9ae4a0d56569d3ade6d65ccf3f0dbb537763ae107360de4cb73578
7
+ data.tar.gz: 786633e1af17f4821ee856d25c9621cef95367a7cf00acb3ff2dfff4dd563a6d3095ba82a86ccfeb3a1031d7f987548067b5f6138c6510d523284ce4526c45c9
@@ -13,17 +13,22 @@ jobs:
13
13
  platform:
14
14
  - "x64-mingw32"
15
15
  - "x64-mingw-ucrt"
16
- name: cross-compile-windows
16
+ - "x86_64-linux-gnu"
17
+ - "x86_64-linux-musl"
18
+ - "aarch64-linux-gnu"
19
+ - "aarch64-linux-musl"
20
+
21
+ name: cross-compile
17
22
  runs-on: ubuntu-22.04
18
- container:
19
- image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.7.0-mri-${{ matrix.platform }}"
20
23
  steps:
21
24
  - uses: actions/checkout@v4
22
25
 
23
- - run: git config --global --add safe.directory /__w/tiny_tds/tiny_tds # shrug
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: "2.7"
24
30
 
25
- - name: Install gems
26
- shell: bash
31
+ - name: "Install dependencies"
27
32
  run: bundle install
28
33
 
29
34
  - name: Write used versions into file
@@ -34,14 +39,14 @@ jobs:
34
39
  uses: actions/cache@v4
35
40
  with:
36
41
  path: ports
37
- key: cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
42
+ key: cross-compiled-v1-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
38
43
  restore-keys: |
39
- cross-compiled-v3-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
40
- cross-compiled-v3-${{ matrix.platform }}-
44
+ cross-compiled-v1-${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
45
+ cross-compiled-v1-${{ matrix.platform }}-
41
46
 
42
47
  - name: Build gem
43
48
  shell: bash
44
- run: bundle exec rake gem:for_platform[${{ matrix.platform }}]
49
+ run: bundle exec rake gem:native:${{ matrix.platform }}
45
50
 
46
51
  - uses: actions/upload-artifact@v4
47
52
  with:
@@ -89,6 +94,18 @@ jobs:
89
94
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
90
95
  exit $LASTEXITCODE
91
96
 
97
+ - name: Test if tsql wrapper works
98
+ shell: pwsh
99
+ run: |
100
+ tsql-ttds -C
101
+ exit $LASTEXITCODE
102
+
103
+ - name: Test if defncopy wrapper works
104
+ shell: pwsh
105
+ run: |
106
+ defncopy-ttds -v
107
+ exit $LASTEXITCODE
108
+
92
109
  test-windows-mingw:
93
110
  needs:
94
111
  - cross-compile
@@ -123,21 +140,9 @@ jobs:
123
140
 
124
141
  - name: Install native gem and restore cross-compiled code from it
125
142
  shell: pwsh
126
- run: |
127
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
128
- $gemVersion = (Get-Content VERSION).Trim()
129
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
130
-
131
- Write-Host "Looking to unpack $gemToUnpack"
132
- gem unpack --target ./tmp "$gemToUnpack"
133
-
134
- # Restore precompiled code
135
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
136
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
137
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
138
-
139
- # Restore ports
140
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
143
+ run: "& ./test/bin/restore-from-native-gem.ps1"
144
+ env:
145
+ RUBY_ARCHITECTURE: "x64-mingw32"
141
146
 
142
147
  - name: Setup MSSQL
143
148
  uses: rails-sqlserver/setup-mssql@v1
@@ -214,6 +219,18 @@ jobs:
214
219
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
215
220
  exit $LASTEXITCODE
216
221
 
222
+ - name: Test if tsql wrapper works
223
+ shell: pwsh
224
+ run: |
225
+ tsql-ttds -C
226
+ exit $LASTEXITCODE
227
+
228
+ - name: Test if defncopy wrapper works
229
+ shell: pwsh
230
+ run: |
231
+ defncopy-ttds -v
232
+ exit $LASTEXITCODE
233
+
217
234
  test-windows-ucrt:
218
235
  needs:
219
236
  - cross-compile
@@ -250,21 +267,9 @@ jobs:
250
267
 
251
268
  - name: Install native gem and restore cross-compiled code from it
252
269
  shell: pwsh
253
- run: |
254
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
255
- $gemVersion = (Get-Content VERSION).Trim()
256
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
257
-
258
- Write-Host "Looking to unpack $gemToUnpack"
259
- gem unpack --target ./tmp "$gemToUnpack"
260
-
261
- # Restore precompiled code
262
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
263
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
264
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
265
-
266
- # Restore ports
267
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
270
+ run: "& ./test/bin/restore-from-native-gem.ps1"
271
+ env:
272
+ RUBY_ARCHITECTURE: "x64-mingw-ucrt"
268
273
 
269
274
  - name: Setup MSSQL
270
275
  uses: rails-sqlserver/setup-mssql@v1
@@ -336,44 +341,94 @@ jobs:
336
341
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
337
342
  exit $LASTEXITCODE
338
343
 
339
- compile-native-ports:
344
+ - name: Test if tsql wrapper works
345
+ shell: pwsh
346
+ run: |
347
+ tsql-ttds -C
348
+ exit $LASTEXITCODE
349
+
350
+ - name: Test if defncopy wrapper works
351
+ shell: pwsh
352
+ run: |
353
+ defncopy-ttds -v
354
+ exit $LASTEXITCODE
355
+
356
+ install-linux:
357
+ needs:
358
+ - cross-compile
359
+ strategy:
360
+ fail-fast: false
361
+ matrix:
362
+ platform:
363
+ - "x86_64-linux-gnu"
364
+ - "x86_64-linux-musl"
365
+ - "aarch64-linux-gnu"
366
+ - "aarch64-linux-musl"
367
+
368
+ ruby-version:
369
+ - "2.7"
370
+ - "3.0"
371
+ - "3.1"
372
+ - "3.2"
373
+ - "3.3"
374
+ - "3.4"
375
+
376
+ include:
377
+ - platform: x86_64-linux-musl
378
+ docker_tag: "-alpine"
379
+ bootstrap: "apk add -U build-base &&" # required to compile bigdecimal on Ruby 2.7
380
+
381
+ - platform: aarch64-linux-gnu
382
+ docker_platform: "--platform=linux/arm64"
383
+
384
+ - platform: aarch64-linux-musl
385
+ docker_platform: "--platform=linux/arm64"
386
+ docker_tag: "-alpine"
387
+ bootstrap: "apk add -U build-base &&"
388
+
389
+ name: install-linux
340
390
  runs-on: ubuntu-22.04
341
- name: cross-compile-linux
342
391
  steps:
343
392
  - uses: actions/checkout@v4
344
393
 
345
- - uses: ruby/setup-ruby@v1
346
- with:
347
- ruby-version: 3.4
348
- bundler-cache: true
349
-
350
- - name: Write used versions into file
351
- run: bundle exec rake ports:version_file
352
-
353
- - name: Cache ports
354
- uses: actions/cache@v4
394
+ - name: Download precompiled gem
395
+ uses: actions/download-artifact@v4
355
396
  with:
356
- path: ports
357
- key: native-v3-${{ hashFiles('**/.ports_versions') }}
358
- restore-keys: |
359
- native-v3-${{ hashFiles('* */.ports_versions') }}
360
- native-v3-
361
-
362
- - name: Build required libraries
363
- run: |
364
- bundle exec rake ports
397
+ name: gem-${{ matrix.platform }}
398
+ path: precompiled/gems
399
+
400
+ - name: Setup QEMU for docker
401
+ uses: docker/setup-qemu-action@v3
402
+ if: ${{ matrix.docker_platform }} != ''
403
+
404
+ - run: |
405
+ docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \
406
+ ${{ matrix.docker_platform }} ruby:${{ matrix.ruby-version }}${{ matrix.docker_tag }} \
407
+ sh -c "
408
+ gem update --system 3.3.22 &&
409
+ ${{ matrix.bootstrap }}
410
+ gem install --no-document ./gems/tiny_tds-$(cat VERSION)-${{ matrix.platform }}.gem &&
411
+ ruby -e \"require 'tiny_tds'; puts TinyTds::Gem.root_path\" &&
412
+ tsql-ttds -C &&
413
+ defncopy-ttds -v
414
+ "
365
415
 
366
416
  test-linux:
367
417
  needs:
368
- - compile-native-ports
418
+ - cross-compile
369
419
  name: test-linux
370
420
  strategy:
371
421
  fail-fast: false
372
422
  matrix:
423
+ force-encryption:
424
+ - false
425
+ - true
426
+
373
427
  mssql-version:
374
428
  - 2017
375
429
  - 2019
376
430
  - 2022
431
+
377
432
  ruby-version:
378
433
  - "2.7"
379
434
  - "3.0"
@@ -391,20 +446,16 @@ jobs:
391
446
  ruby-version: ${{ matrix.ruby-version }}
392
447
  bundler-cache: true
393
448
 
394
- - name: Write used versions into file
395
- run: |
396
- bundle exec rake ports:version_file
397
-
398
- - name: Cache ports
399
- uses: actions/cache@v4
449
+ - name: Download precompiled gem
450
+ uses: actions/download-artifact@v4
400
451
  with:
401
- path: ports
402
- key: native-v3-${{ hashFiles('**/.ports_versions') }}
403
- fail-on-cache-miss: true
452
+ name: gem-x86_64-linux-gnu
404
453
 
405
- - name: Build gem
406
- run: |
407
- bundle exec rake build
454
+ - name: Install native gem and restore cross-compiled code from it
455
+ shell: pwsh
456
+ run: "& ./test/bin/restore-from-native-gem.ps1"
457
+ env:
458
+ RUBY_ARCHITECTURE: "x86_64-linux-gnu"
408
459
 
409
460
  - name: Setup MSSQL
410
461
  uses: rails-sqlserver/setup-mssql@v1
@@ -412,6 +463,7 @@ jobs:
412
463
  components: sqlcmd,sqlengine
413
464
  version: ${{ matrix.mssql-version }}
414
465
  sa-password: "c0MplicatedP@ssword"
466
+ force-encryption: ${{ matrix.force-encryption }}
415
467
 
416
468
  - name: Setup MSSQL database
417
469
  run: |
@@ -435,6 +487,52 @@ jobs:
435
487
  paths: "test/reports/TEST-*.xml"
436
488
  if: always()
437
489
 
490
+ install-linux-native:
491
+ strategy:
492
+ fail-fast: false
493
+ matrix:
494
+ ruby-version:
495
+ - "2.7"
496
+ - "3.0"
497
+ - "3.1"
498
+ - "3.2"
499
+ - "3.3"
500
+ - "3.4"
501
+
502
+ name: install-linux-native
503
+ runs-on: ubuntu-22.04
504
+ steps:
505
+ - uses: actions/checkout@v4
506
+
507
+ - uses: ruby/setup-ruby@v1
508
+ with:
509
+ ruby-version: ${{ matrix.ruby-version }}
510
+ bundler-cache: true
511
+
512
+ - name: Install FreeTDS
513
+ shell: bash
514
+ run: ./test/bin/install-freetds.sh
515
+
516
+ - name: Build gem
517
+ shell: bash
518
+ run: gem build tiny_tds.gemspec
519
+
520
+ - name: Install gem
521
+ shell: bash
522
+ run: gem install "tiny_tds-$(cat VERSION).gem"
523
+
524
+ - name: Test if TinyTDS loads
525
+ shell: bash
526
+ run: ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
527
+
528
+ - name: Test if tsql wrapper works
529
+ shell: bash
530
+ run: tsql-ttds -C
531
+
532
+ - name: Test if defncopy wrapper works
533
+ shell: bash
534
+ run: defncopy-ttds -v
535
+
438
536
  install_macos:
439
537
  strategy:
440
538
  fail-fast: false
@@ -475,3 +573,18 @@ jobs:
475
573
  shell: bash
476
574
  run: |
477
575
  ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
576
+
577
+ standardrb:
578
+ name: standardrb
579
+ runs-on: ubuntu-22.04
580
+ steps:
581
+ - uses: actions/checkout@v4
582
+
583
+ - uses: ruby/setup-ruby@v1
584
+ with:
585
+ ruby-version: "2.7"
586
+ bundler-cache: true
587
+
588
+ - name: Check standardrb
589
+ shell: bash
590
+ run: bundle exec standardrb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 3.2.0
2
+
3
+ * Reduce number of files shipped with precompiled Windows gem
4
+ * Provide precompiled gem for Linux (GNU + MUSL / 64-bit x86 + ARM)
5
+ * Fix wrappers for `tsql` and `defncopy` utility.
6
+ * Use libiconv v1.18 and freetds v1.4.26 for Windows and Linux builds
7
+
1
8
  ## 3.1.0
2
9
 
3
10
  * Add Ruby 3.4 to the cross compile list
@@ -13,6 +20,7 @@
13
20
  * Add `bigdecimal` to dependencies
14
21
 
15
22
  ## 2.1.7
23
+
16
24
  * Add Ruby 3.3 to the cross compile list
17
25
 
18
26
  ## 2.1.6
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
data/README.md CHANGED
@@ -18,16 +18,42 @@ The API is simple and consists of these classes:
18
18
 
19
19
  ## Install
20
20
 
21
- Installing with rubygems should just work. TinyTDS is currently tested on Ruby version 2.7.0 and upward.
21
+ tiny_tds is tested with Ruby v2.7 and upwards.
22
22
 
23
+ ### Windows and Linux (64-bit)
24
+
25
+ We precompile tiny_tds with FreeTDS and supporting libraries, which are dynamically linked at runtime. Therefore, you can run:
26
+
27
+ ```shell
28
+ gem install tiny_tds
23
29
  ```
24
- $ gem install tiny_tds
30
+
31
+ It should find the platform-specific gem.
32
+
33
+ You can also avoid getting the platform-specific gem if you want to compile FreeTDS and supporting libraries yourself:
34
+
35
+ ```shell
36
+ gem install tiny_tds --platform ruby
25
37
  ```
26
38
 
27
- If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS and supporting libraries.
28
- If you're using RubyInstaller, the binary gem will require that devkit is installed and in your path to operate properly.
39
+ ### Mac
29
40
 
30
- On all other platforms, we will find these dependencies. It is recommended that you install the latest FreeTDS via your method of choice. For example, here is how to install FreeTDS on Ubuntu. You might also need the `build-essential` and possibly the `libc6-dev` packages.
41
+ Install FreeTDS via Homebrew:
42
+
43
+ ```shell
44
+ brew install openssl@3 libiconv
45
+ brew install freetds
46
+ ```
47
+
48
+ Then you can install tiny_tds:
49
+
50
+ ```shell
51
+ gem install tiny_tds
52
+ ```
53
+
54
+ ### Everybody else
55
+
56
+ `tiny_tds` will find FreeTDS and other libraries based on your compiler paths. Below you can see an example on how to install FreeTDS on a Debian system.
31
57
 
32
58
  ```shell
33
59
  $ apt-get install wget
@@ -37,41 +63,21 @@ $ apt-get install libc6-dev
37
63
  $ wget http://www.freetds.org/files/stable/freetds-1.4.23.tar.gz
38
64
  $ tar -xzf freetds-1.4.23.tar.gz
39
65
  $ cd freetds-1.4.23
40
- $ ./configure --prefix=/usr/local --with-tdsver=7.4
66
+ $ ./configure --prefix=/usr/local --with-tdsver=7.4 --disable-odbc
41
67
  $ make
42
68
  $ make install
43
69
  ```
44
70
 
45
- Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
71
+ You can also tell `tiny_tds` where to find your FreeTDS installation.
46
72
 
73
+ ```shell
74
+ gem install tiny_tds -- --with-freetds-dir=/opt/freetds
47
75
  ```
48
- --with-freetds-dir=DIR
49
- Use the freetds library placed under DIR.
50
- ```
51
-
52
76
 
53
77
  ## Getting Started
54
78
 
55
79
  Optionally, Microsoft has done a great job writing [an article](https://learn.microsoft.com/en-us/sql/connect/ruby/ruby-driver-for-sql-server?view=sql-server-ver16) on how to get started with SQL Server and Ruby using TinyTDS, however, the articles are using outdated versions.
56
80
 
57
-
58
- ## FreeTDS Compatibility & Configuration
59
-
60
- TinyTDS is developed against FreeTDs 1.1+. We also test with SQL Server 2017, 2019, 2022 and Azure. Older version of SQL Server or FreeTDS could work, but are not supported.
61
-
62
- > [!IMPORTANT]
63
- >
64
- > Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
65
-
66
- * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
67
-
68
- * **OK, I am installing FreeTDS, how do I configure it?** Contrary to what most people think, you do not need to specially configure FreeTDS in any way for client libraries like TinyTDS to use it. About the only requirement is that you compile it with libiconv for proper encoding support. FreeTDS must also be compiled with OpenSSL (or the like) to use it with Azure. See the "Using TinyTDS with Azure" section below for more info.
69
-
70
- * **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have to. This is only a default for clients/configs that do not specify what TDS version they want to use.
71
-
72
- * **I want to configure FreeTDS using `--enable-msdblib` and/or `--enable-sybase-compat` so it works for my database. Cool?** It's a waste of time and totally moot! Client libraries like TinyTDS define their own C structure names where they diverge from Sybase to SQL Server. Technically we use the MSDBLIB structures which does not mean we only work with that database vs Sybase. These configs are just a low level default for C libraries that do not define what they want. So I repeat, you do not NEED to use any of these, nor will they hurt anything since we control what C structure names we use internally!
73
-
74
-
75
81
  ## Data Types
76
82
 
77
83
  Our goal is to support every SQL Server data type and covert it to a logical Ruby object. When dates or times are returned, they are instantiated to either `:utc` or `:local` time depending on the query options. Only [datetimeoffset] types are excluded. All strings are associated the to the connection's encoding and all binary data types are associated to Ruby's `ASCII-8BIT/BINARY` encoding.
@@ -387,19 +393,6 @@ Please read our [thread_test.rb](https://github.com/rails-sqlserver/tiny_tds/blo
387
393
 
388
394
  This is possible. Since FreeTDS v1.0, utf-16 is enabled by default and supported by tiny_tds. You can toggle it by using `use_utf16` when establishing the connection.
389
395
 
390
- ## Compiling Gems for Windows
391
-
392
- For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides several [Docker images](https://registry.hub.docker.com/u/larskanis/) with rvm, cross-compilers and a number of different target versions of Ruby.
393
-
394
- Run the following rake task to compile the gems for Windows. This will check the availability of [Docker](https://www.docker.com/) (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:
395
-
396
- ```
397
- $ rake gem:native
398
- ```
399
-
400
- The compiled gems will exist in `./pkg` directory.
401
-
402
-
403
396
  ## Development & Testing
404
397
 
405
398
  First, clone the repo using the command line or your Git GUI of choice.
@@ -446,16 +439,32 @@ $ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2017
446
439
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
447
440
  ```
448
441
 
449
- ## Docker Builds
442
+ ### Code formatting
450
443
 
451
- If you use a [multi stage](https://docs.docker.com/develop/develop-images/multistage-build/) Docker build to assemble your gems in one phase and then copy your app and gems
452
- into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
444
+ We are using `standardrb` to format our code. Just run `bundle exec standardrb --fix` to format all Ruby files.
453
445
 
454
- After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
455
- it [already knows to look here](https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/extconf.rb#L31) but if you copy your app to a new container that link will be broken.
446
+ ### Compiling Gems for Windows and Linux
447
+
448
+ > [!WARNING]
449
+ > Compiling the Gems on native Windows currently does not work.
450
+
451
+ For the convenience, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows and Linux. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used.
452
+
453
+ Run the following rake task to compile the gems. This will check the availability of [Docker](https://www.docker.com/) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:
454
+
455
+ ```shell
456
+ bundle exec rake gem:native
457
+ ```
458
+
459
+ The compiled gems will exist in `./pkg` directory.
460
+
461
+ If you only need a specific gem for one platform and architecture, run this command:
462
+
463
+ ```shell
464
+ bundle exec rake gem:native:x64-mingw-ucrt
465
+ ```
456
466
 
457
- Set the LD_LIBRARY_PATH environment variable `export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}` and run `ldconfig`. If you run `ldd tiny_tds.so` you should not see any broken links. Make
458
- sure you also copied in the library dependencies from your build container with a command like `COPY --from=builder /usr/local/lib /usr/local/lib`.
467
+ All the supported architectures and platforms are listed in the `Rakefile` in the `CrossLibraries` constant.
459
468
 
460
469
  ## Help & Support
461
470
 
@@ -481,4 +490,4 @@ My name is Ken Collins and I currently maintain the SQL Server adapter for Activ
481
490
 
482
491
  ## License
483
492
 
484
- TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows binaries contain pre-compiled versions of FreeTDS <http://www.freetds.org/> which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>
493
+ TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows and Linux binaries contain pre-compiled versions of FreeTDS <http://www.freetds.org/> and `libconv` which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>. They also contain OpenSSL, which is licensed under the OpenSSL license at <https://openssl-library.org/source/license/index.html>.
data/Rakefile CHANGED
@@ -1,56 +1,65 @@
1
- # encoding: UTF-8
2
- require 'rbconfig'
3
- require 'rake'
4
- require 'rake/clean'
5
- require 'rake/extensiontask'
6
- require_relative './ext/tiny_tds/extconsts'
7
-
8
- SPEC = Gem::Specification.load(File.expand_path('../tiny_tds.gemspec', __FILE__))
9
-
10
- ruby_cc_ucrt_versions = "3.4.0:3.3.5:3.2.0:3.1.0".freeze
11
- ruby_cc_mingw32_versions = "3.0.0:2.7.0".freeze
12
-
13
- GEM_PLATFORM_HOSTS = {
14
- 'x64-mingw32' => {
15
- host: 'x86_64-w64-mingw32',
16
- ruby_versions: ruby_cc_mingw32_versions
17
- },
18
- 'x64-mingw-ucrt' => {
19
- host: 'x86_64-w64-mingw32',
20
- ruby_versions: ruby_cc_ucrt_versions
21
- },
22
- }
1
+ require "rbconfig"
2
+ require "rake"
3
+ require "rake/clean"
4
+ require "rake/extensiontask"
5
+
6
+ SPEC = Gem::Specification.load(File.expand_path("../tiny_tds.gemspec", __FILE__))
7
+
8
+ CrossLibrary = Struct.new :platform, :openssl_config
9
+ CrossLibraries = [
10
+ ["x64-mingw-ucrt", "mingw64"],
11
+ ["x64-mingw32", "mingw64"],
12
+ ["x86_64-linux-gnu", "linux-x86_64"],
13
+ ["x86_64-linux-musl", "linux-x86_64"],
14
+ ["aarch64-linux-gnu", "linux-aarch64"],
15
+ ["aarch64-linux-musl", "linux-aarch64"]
16
+ ].map do |platform, openssl_config|
17
+ CrossLibrary.new platform, openssl_config
18
+ end
23
19
 
24
20
  # Add our project specific files to clean for a rebuild
25
- CLEAN.include FileList["{ext,lib}/**/*.{so,#{RbConfig::CONFIG['DLEXT']},o}"],
26
- FileList["exe/*"]
21
+ CLEAN.include FileList["{ext,lib}/**/*.{so,#{RbConfig::CONFIG["DLEXT"]},o}"],
22
+ FileList["exe/*"]
27
23
 
28
24
  # Clobber all our temp files and ports files including .install files
29
25
  # and archives
30
26
  CLOBBER.include FileList["tmp/**/*"],
31
- FileList["ports/**/*"].exclude(%r{^ports/archives})
27
+ FileList["ports/**/*"].exclude(%r{^ports/archives})
32
28
 
33
- Dir['tasks/*.rake'].sort.each { |f| load f }
29
+ Dir["tasks/*.rake"].sort.each { |f| load f }
34
30
 
35
- Rake::ExtensionTask.new('tiny_tds', SPEC) do |ext|
36
- ext.lib_dir = 'lib/tiny_tds'
31
+ Rake::ExtensionTask.new("tiny_tds", SPEC) do |ext|
32
+ ext.lib_dir = "lib/tiny_tds"
37
33
  ext.cross_compile = true
38
- ext.cross_platform = GEM_PLATFORM_HOSTS.keys
34
+ ext.cross_platform = CrossLibraries.map(&:platform)
39
35
 
40
36
  # Add dependent DLLs to the cross gems
41
37
  ext.cross_compiling do |spec|
42
38
  # The fat binary gem doesn't depend on the freetds package, since it bundles the library.
43
- spec.metadata.delete('msys2_mingw_dependencies')
39
+ spec.metadata.delete("msys2_mingw_dependencies")
44
40
 
45
- # We don't need the sources in a fat binary gem
46
- spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
47
-
48
- # Make sure to include the ports binaries and libraries
49
- spec.files += FileList["ports/#{spec.platform.to_s}/**/**/{bin,lib}/*"].exclude do |f|
50
- File.directory? f
41
+ if /mingw/.match?(spec.platform.to_s)
42
+ spec.files += [
43
+ "ports/#{spec.platform}/bin/libsybdb-5.dll",
44
+ "ports/#{spec.platform}/bin/defncopy.exe",
45
+ "ports/#{spec.platform}/bin/tsql.exe"
46
+ ]
47
+ elsif /linux/.match?(spec.platform.to_s)
48
+ spec.files += [
49
+ "ports/#{spec.platform}/lib/libsybdb.so.5",
50
+ "ports/#{spec.platform}/bin/defncopy",
51
+ "ports/#{spec.platform}/bin/tsql"
52
+ ]
51
53
  end
54
+ end
52
55
 
53
- spec.files += Dir.glob('exe/*')
56
+ ext.cross_config_options += CrossLibraries.map do |xlib|
57
+ {
58
+ xlib.platform => [
59
+ "--with-cross-build=#{xlib.platform}",
60
+ "--with-openssl-platform=#{xlib.openssl_config}"
61
+ ]
62
+ }
54
63
  end
55
64
  end
56
65
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.2.0