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/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



240
241
242
243
# File 'ext/extconf.rb', line 240

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
127
128
129
130
131
132
133
134
135
136
137
# File 'ext/extconf.rb', line 110

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

  uri = URI.parse(downloadLink)
  if ZIP
    filename = "#{destination}/clidriver.zip"
  else
    filename = "#{destination}/clidriver.tar.gz"
  end

  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

#extract_zip(file, destination) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
# File 'ext/extconf.rb', line 139

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



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
316
317
# File 'ext/extconf.rb', line 274

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



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

alias :libpathflag0 :libpathflag

#untarCLIPackage(archive, destination) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'ext/extconf.rb', line 151

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