Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Arel, CallChain, IBM_DB, Kernel 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



229
230
231
232
# File 'ext/extconf.rb', line 229

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

#downloadCLIPackage(destination, link = nil) ⇒ Object



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

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



128
129
130
131
132
133
134
135
136
137
138
# File 'ext/extconf.rb', line 128

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



263
264
265
266
267
268
269
270
271
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
# File 'ext/extconf.rb', line 263

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



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

alias :libpathflag0 :libpathflag

#untarCLIPackage(archive, destination) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'ext/extconf.rb', line 140

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
        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!
        File.symlink entry.header.linkname, file
      end
    end
  end
end