Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Arel, 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/sunamd32_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



201
202
203
204
# File 'ext/extconf.rb', line 201

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

#downloadCLIPackage(destination, link = nil) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'ext/extconf.rb', line 91

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



231
232
233
234
235
236
237
238
239
240
241
242
# File 'ext/extconf.rb', line 231

def libpathflag(libpath)
  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
  #libpathflag0 + " '-Wl,-R$$ORIGIN/clidriver/lib #{ldflags}' "
  libpathflag0 + " '-Wl,-R$$ORIGIN/clidriver/lib' "
end

#libpathflag0Object



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

alias :libpathflag0 :libpathflag

#untarCLIPackage(archive, destination) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'ext/extconf.rb', line 116

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