class Object

Constants

HEADERS

Public Instance Methods

check_db() click to toggle source
# File ext/rpm/extconf.rb, line 26
def check_db
  dir_config('db')
  if have_library("db-4.2","db_version")
    return true
  end
  4.downto(2) do |i|
    if have_library("db-#{i}.0", "db_version") or
        have_library("db#{i}", "db_version") then
      return true
    end
  end
  if have_library("db", "db_version") then
    true
  else
    STDERR.puts "db not found"
  end
end
check_debug() click to toggle source
# File ext/rpm/extconf.rb, line 80
def check_debug
  if ENV["RUBYRPM_DEBUG"] then
    puts "debug mode\n"
    $CFLAGS="#{$CFLAGS} -O0 -g -ggdb"
  else
    puts "non-debug mode\n"
  end
end
check_popt() click to toggle source
# File ext/rpm/extconf.rb, line 17
def check_popt
  if have_header('popt.h') and have_library('popt') then
    true
  else
    STDERR.puts "libpopt not found"
    false
  end
end
check_rpm() click to toggle source
# File ext/rpm/extconf.rb, line 44
def check_rpm
  # Set things up manually
  dir_config("rpm")
  $libs = append_library($libs, 'rpmdb') if rpm_version < rpm_version([4,6,0])
  $libs = append_library($libs, 'rpm')
  $libs = append_library($libs, 'rpmbuild') if rpm_version >= rpm_version([4,9,0]) && rpm_version < rpm_version([5,0,0])
  have_library('rpmbuild', 'getBuildTime')
  $libs = append_library($libs, 'rpmio') if rpm_version >= rpm_version([4,10,0]) && rpm_version < rpm_version([5,0,0])
  if rpm_version >= rpm_version([4,6,0])
    $defs << "-D_RPM_4_4_COMPAT"
    return true
  end
  if have_header('rpm/rpmlib.h') and
      check_db and
      have_library('rpmio') then
    true
  else
    STDERR.puts "rpm library not found"
    false
  end
end
check_rpm_version() click to toggle source
# File ext/rpm/extconf.rb, line 74
def check_rpm_version
  # TODO: zaki: strict checking is requires
  verflag = "-DRPM_VERSION_CODE=#{rpm_version}"
  $defs << verflag
end
rpm_version(ver=[]) click to toggle source

if no parameters, returns the installed rpm version, or the one specified by the array ie: [4,1,0]

# File ext/rpm/extconf.rb, line 69
def rpm_version(ver=[])
  ver = %x`LANG=C rpm --version| cut -d' ' -f 3`.split(/\./) if ver.empty?
  return (ver[0].to_i<<16) + (ver[1].to_i<<8) + (ver[2].to_i<<0)
end