Skip to content

Commit c4732bf

Browse files
committed
Support for MAC ARM64
Signed-off-by: Praveen Narayanappa <pnarayanappa@rocketsoftware.com>
1 parent 7f3b194 commit c4732bf

11 files changed

Lines changed: 53 additions & 22 deletions

File tree

IBM_DB_Adapter/ibm_db/CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Change Log
22
==============
3+
2024/12/13 (IBM_DB adapter 5.5.1, driver 3.1.1)
4+
- Support for MAC ARM64
5+
6+
2024/07/10 (IBM_DB adapter 5.5.0, driver 3.1.0)
7+
- Support for ruby 3.2 and rails 7.1.3.2
8+
39
2023/10/11 (IBM_DB adapter 5.4.2, driver 3.1.0)
410
- config.yml to have Environment variables to specify credentials.
511

IBM_DB_Adapter/ibm_db/IBM_DB.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# +----------------------------------------------------------------------+
22
# | Licensed Materials - Property of IBM |
33
# | |
4-
# | (C) Copyright IBM Corporation 2006- 2022 |
4+
# | (C) Copyright IBM Corporation 2006- 2024 |
55
# +----------------------------------------------------------------------+
66

77
require 'rubygems'
@@ -10,7 +10,7 @@ require 'pathname'
1010
Gem::Specification.new do |spec|
1111
# Required spec
1212
spec.name = 'ibm_db'
13-
spec.version = '5.5.0'
13+
spec.version = '5.5.1'
1414
spec.summary = 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows, DB2 on zOS, DB2 on i5/OS, Informix (IDS)}'
1515

1616
# Optional spec

IBM_DB_Adapter/ibm_db/ext/extconf.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# +----------------------------------------------------------------------+
1111
# | Licensed Materials - Property of IBM |
1212
# | |
13-
# | (C) Copyright IBM Corporation 2006 - 2016 |
13+
# | (C) Copyright IBM Corporation 2006 - 2024 |
1414
# +----------------------------------------------------------------------+
1515

1616
TAR_LONGLINK = '././@LongLink'
@@ -90,8 +90,11 @@ def suppress_warnings
9090
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sunamd32_odbc_cli.tar.gz"
9191
end
9292
elsif (RUBY_PLATFORM =~ /darwin/i)
93-
if(is64Bit)
94-
puts "Detected platform - MacOS darwin64"
93+
if (RUBY_PLATFORM =~ /arm64/i)
94+
puts "Detected platform - MacOS darwin arm64"
95+
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macarm64_odbc_cli.tar.gz"
96+
elsif(RUBY_PLATFORM =~ /x86_64/i || is64Bit)
97+
puts "Detected platform - MacOS darwin x86_64"
9598
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz"
9699
else
97100
puts "Mac OS 32 bit not supported. Please use an x64 architecture."
@@ -151,11 +154,17 @@ def untarCLIPackage(archive,destination)
151154
FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
152155
elsif entry.file?
153156
FileUtils.rm_rf file if File.directory? file
157+
if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
158+
FileUtils.chmod 755, file, :verbose => false
159+
end
154160
File.open file, "wb" do |f|
155161
f.print entry.read
156162
end
157163
FileUtils.chmod entry.header.mode, file, :verbose => false
158164
elsif entry.header.typeflag == '2' #Symlink!
165+
if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
166+
File.delete file if File.file? file
167+
end
159168
File.symlink entry.header.linkname, file
160169
end
161170
end

IBM_DB_Adapter/ibm_db/ext/ibm_db.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
+----------------------------------------------------------------------+
33
| Licensed Materials - Property of IBM |
44
| |
5-
| (C) Copyright IBM Corporation 2006 - 2022 |
5+
| (C) Copyright IBM Corporation 2006 - 2024 |
66
+----------------------------------------------------------------------+
77
| Authors: Sushant Koduru, Lynh Nguyen, Kanchana Padmanabhan, |
88
| Dan Scott, Helmut Tessarek, Sam Ruby, Kellen Bombardier, |
@@ -12,7 +12,7 @@
1212
+----------------------------------------------------------------------+
1313
*/
1414

15-
#define MODULE_RELEASE "3.1.0"
15+
#define MODULE_RELEASE "3.1.1"
1616

1717
#ifdef HAVE_CONFIG_H
1818
#include "config.h"
@@ -11237,7 +11237,7 @@ VALUE ibm_db_server_info(int argc, VALUE *argv, VALUE self)
1123711237
rb_scan_args(argc, argv, "1", &connection);
1123811238

1123911239

11240-
if(NIL_P(&connection))
11240+
if(NIL_P(connection))
1124111241
{
1124211242
}
1124311243
if(&connection == NULL)

IBM_DB_Adapter/ibm_db/ext/ruby_ibm_db_cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ int _ruby_ibm_db_SQLForeignKeys_helper(metadata_args *data) {
208208

209209
data->stmt_res->is_executing = 1;
210210

211-
if(!NIL_P(data->table_type))
211+
if(data->table_type != NULL && !NIL_P(*data->table_type))
212212
{
213213
#ifndef UNICODE_SUPPORT_VERSION_H
214214
rc = SQLForeignKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,

IBM_DB_Adapter/ibm_db/lib/IBM_DB.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if(RUBY_PLATFORM =~ /darwin/i)
22
cliPackagePath = File.dirname(__FILE__) + '/clidriver'
3-
if(Dir.exists?(cliPackagePath))
3+
if(Dir.exist?(cliPackagePath))
44
currentPath = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}"
55

66
cmd = "chmod 755 #{currentPath}/lib/ibm_db.bundle "

IBM_DB_Driver/extconf.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# +----------------------------------------------------------------------+
1111
# | Licensed Materials - Property of IBM |
1212
# | |
13-
# | (C) Copyright IBM Corporation 2006 - 2016 |
13+
# | (C) Copyright IBM Corporation 2006 - 2024 |
1414
# +----------------------------------------------------------------------+
1515

1616
TAR_LONGLINK = '././@LongLink'
@@ -90,8 +90,11 @@ def suppress_warnings
9090
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sunamd32_odbc_cli.tar.gz"
9191
end
9292
elsif (RUBY_PLATFORM =~ /darwin/i)
93-
if(is64Bit)
94-
puts "Detected platform - MacOS darwin64"
93+
if (RUBY_PLATFORM =~ /arm64/i)
94+
puts "Detected platform - MacOS darwin arm64"
95+
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macarm64_odbc_cli.tar.gz"
96+
elsif(RUBY_PLATFORM =~ /x86_64/i || is64Bit)
97+
puts "Detected platform - MacOS darwin x86_64"
9598
DOWNLOADLINK = "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz"
9699
else
97100
puts "Mac OS 32 bit not supported. Please use an x64 architecture."
@@ -151,11 +154,17 @@ def untarCLIPackage(archive,destination)
151154
FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
152155
elsif entry.file?
153156
FileUtils.rm_rf file if File.directory? file
157+
if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
158+
FileUtils.chmod 755, file, :verbose => false
159+
end
154160
File.open file, "wb" do |f|
155161
f.print entry.read
156162
end
157163
FileUtils.chmod entry.header.mode, file, :verbose => false
158164
elsif entry.header.typeflag == '2' #Symlink!
165+
if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
166+
File.delete file if File.file? file
167+
end
159168
File.symlink entry.header.linkname, file
160169
end
161170
end

IBM_DB_Driver/ibm_db.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
+----------------------------------------------------------------------+
33
| Licensed Materials - Property of IBM |
44
| |
5-
| (C) Copyright IBM Corporation 2006 - 2022 |
5+
| (C) Copyright IBM Corporation 2006 - 2024 |
66
+----------------------------------------------------------------------+
77
| Authors: Sushant Koduru, Lynh Nguyen, Kanchana Padmanabhan, |
88
| Dan Scott, Helmut Tessarek, Sam Ruby, Kellen Bombardier, |
@@ -12,7 +12,7 @@
1212
+----------------------------------------------------------------------+
1313
*/
1414

15-
#define MODULE_RELEASE "3.1.0"
15+
#define MODULE_RELEASE "3.1.1"
1616

1717
#ifdef HAVE_CONFIG_H
1818
#include "config.h"
@@ -686,8 +686,7 @@ static void _ruby_ibm_db_mark_stmt_struct(stmt_handle *handle)
686686
static inline
687687
VALUE ibm_Ruby_Thread_Call(rb_blocking_function_t *func, void *data1, rb_unblock_function_t *ubf, void *data2)
688688
{
689-
void *(*f)(void*) = (void *(*)(void*))func;
690-
return (VALUE)rb_thread_call_without_gvl(f, data1, ubf, data2);
689+
return func(data1);
691690
}
692691

693692

@@ -11238,7 +11237,7 @@ VALUE ibm_db_server_info(int argc, VALUE *argv, VALUE self)
1123811237
rb_scan_args(argc, argv, "1", &connection);
1123911238

1124011239

11241-
if(NIL_P(&connection))
11240+
if(NIL_P(connection))
1124211241
{
1124311242
}
1124411243
if(&connection == NULL)

IBM_DB_Driver/ruby_ibm_db_cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ int _ruby_ibm_db_SQLForeignKeys_helper(metadata_args *data) {
208208

209209
data->stmt_res->is_executing = 1;
210210

211-
if(!NIL_P(data->table_type))
211+
if(data->table_type != NULL && !NIL_P(*data->table_type))
212212
{
213213
#ifndef UNICODE_SUPPORT_VERSION_H
214214
rc = SQLForeignKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,

IBM_DB_Driver/tests.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# +----------------------------------------------------------------------+
22
# | Licensed Materials - Property of IBM |
33
# | |
4-
# | (C) Copyright IBM Corporation 2006, 2007, 2008, 2009, 2010 |
4+
# | (C) Copyright IBM Corporation 2006, 2007, 2008, 2009, 2010, 2024 |
55
# +----------------------------------------------------------------------+
6-
require (RUBY_PLATFORM =~ /mswin32/ || RUBY_PLATFORM =~ /mingw32/ ) ? 'mswin32/ibm_db.so' : 'ibm_db.so'
6+
require case RUBY_PLATFORM
7+
when /mswin32/, /mingw32/
8+
'mswin32/ibm_db.so'
9+
when /darwin/
10+
'ibm_db.bundle'
11+
else
12+
'ibm_db.so'
13+
end
714
require 'stringio'
815
require 'test/unit'
916
require 'fileutils'

0 commit comments

Comments
 (0)