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"
"http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz"
IBM_DB_INCLUDE =
"#{IBM_DB_HOME}/include"
IBM_DB_LIB =
"#{IBM_DB_HOME}/lib32"

Instance Method Summary collapse

Instance Method Details

#crash(str) ⇒ Object



209
210
211
212
# File 'ext/extconf.rb', line 209

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

#downloadCLIPackage(destination, link = nil) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'ext/extconf.rb', line 99

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

  uri = URI.parse(downloadLink)
  filename = "#{destination}/clidriver.tar.gz"

  headers = {
    'Accept-Encoding' => 'identity',
  }

  request = Net::HTTP::Get.new(uri.request_uri, headers)
  http = Net::HTTP.new(uri.host, uri.port)
  response = http.request(request)

  f = open(filename, 'wb')
  f.write(response.body)
  f.close()

  filename
end

#libpathflag(libpath) ⇒ Object



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'ext/extconf.rb', line 243

def libpathflag(libpath)
	if(RUBY_PLATFORM =~ /darwin/i)
		if(RUBY_VERSION =~ /2./)	
			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./)	
			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



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

alias :libpathflag0 :libpathflag

#untarCLIPackage(archive, destination) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'ext/extconf.rb', line 124

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