Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Arel, CallChain, IBM_DB, Kernel, Rails Classes: Fixtures

Constant Summary collapse

'././@LongLink'
WIN =
RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
IBM_DB_HOME =

use ENV or latest db2 you can find

"#{destination}/clidriver"
"https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/nt32_odbc_cli.zip"
ZIP =
true
IBM_DB_INCLUDE =
"#{IBM_DB_HOME}/include"
IBM_DB_LIB =
"#{IBM_DB_HOME}/lib32"

Instance Method Summary collapse

Instance Method Details

#crash(str) ⇒ Object



238
239
240
241
# File 'ext/extconf.rb', line 238

def crash(str)
  printf(" extconf failure: %s\n", str)
  exit 1
end

#downloadCLIPackage(destination, link = nil) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'ext/extconf.rb', line 113

def downloadCLIPackage(destination, link = nil)
  if(link.nil?)
    downloadLink = DOWNLOADLINK
  else
    downloadLink = link
  end

  if ZIP
    filename = "#{destination}/clidriver.zip"
  else
    filename = "#{destination}/clidriver.tar.gz"
  end
  
  Down.download(downloadLink, destination: filename, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)

  filename
end

#extract_zip(file, destination) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
# File 'ext/extconf.rb', line 131

def extract_zip(file, destination)
  FileUtils.mkdir_p(destination)

  Zip::File.open(file) do |zip_file|
    zip_file.each do |f|
      fpath = File.join(destination, f.name)
      FileUtils.mkdir_p(File.dirname(fpath))
      zip_file.extract(f, fpath) unless File.exist?(fpath)
    end
  end
end

#libpathflag(libpath) ⇒ Object



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'ext/extconf.rb', line 272

def libpathflag(libpath)
	if(RUBY_PLATFORM =~ /darwin/i)
		if(RUBY_VERSION =~ /2./ || RUBY_VERSION =~ /3./)	
			libpathflag0 + case RbConfig::CONFIG["arch"]	
			when /solaris2/
			  libpath[0..-2].map {|path| " -R#{path}"}.join
			when /linux/
			  libpath[0..-2].map {|path| " -R#{path} "}.join
			else
			  ""
		    end
		else
			libpathflag0 + case Config::CONFIG["arch"]				
			when /solaris2/
			  libpath[0..-2].map {|path| " -R#{path}"}.join
			when /linux/
			  libpath[0..-2].map {|path| " -R#{path} "}.join
			else
			  ""
			end
		end  
	else
		if(RUBY_VERSION =~ /2./ || RUBY_VERSION =~ /3./)	
			ldflags =  case RbConfig::CONFIG["arch"]	
			when /solaris2/
			  libpath[0..-2].map {|path| " -R#{path}"}.join
			when /linux/
			  libpath[0..-2].map {|path| " -R#{path} "}.join
			else
			  ""
		  end
		else
			ldflags =  case Config::CONFIG["arch"]
			when /solaris2/
			  libpath[0..-2].map {|path| " -R#{path}"}.join
			when /linux/
			  libpath[0..-2].map {|path| " -R#{path} "}.join
			else
			  ""
		    end
		end			
		libpathflag0 + " '-Wl,-R$$ORIGIN/clidriver/lib' "		
	end
end

#libpathflag0Object



271
# File 'ext/extconf.rb', line 271

alias :libpathflag0 :libpathflag

#untarCLIPackage(archive, destination) ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'ext/extconf.rb', line 143

def untarCLIPackage(archive,destination)
  Gem::Package::TarReader.new( Zlib::GzipReader.open(archive) ) do |tar|
    tar.each do |entry|
      file = nil
      if entry.full_name == $TAR_LONGLINK
        file = File.join destination, entry.read.strip
        next
      end
      file ||= File.join destination, entry.full_name
      if entry.directory?
        File.delete file if File.file? file
        FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
      elsif entry.file?
        FileUtils.rm_rf file if File.directory? file
        if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
          FileUtils.chmod 755, file, :verbose => false
        end
        File.open file, "wb" do |f|
          f.print entry.read
        end
        FileUtils.chmod entry.header.mode, file, :verbose => false
      elsif entry.header.typeflag == '2' #Symlink!
        if (RUBY_PLATFORM =~ /darwin/i) && (RUBY_PLATFORM =~ /arm64/i) && File.exist?(file)
           File.delete file if File.file? file
        end
        File.symlink entry.header.linkname, file
      end
    end
  end
end