Top Level Namespace
Defined Under Namespace
Modules: Rlibmemcached
Classes: Memcached
Constant Summary
collapse
- HERE =
File.expand_path(File.dirname(__FILE__))
- LIBMEMCACHED_DIR =
Dir.glob(File.join(HERE, '..', '..', 'vendor',"libmemcached-*")).first
- SOLARIS_32 =
RbConfig::CONFIG['target'] == "i386-pc-solaris2.10"
- BSD =
RbConfig::CONFIG['host_os'].downcase =~ /bsd/
- LIBM_CFLAGS =
$CFLAGS
- LIBM_LDFLAGS =
$LDFLAGS
- GMAKE_CMD =
RbConfig::CONFIG['host_os'].downcase =~ /bsd|solaris/ ? "gmake" : "make"
- TAR_CMD =
SOLARIS_32 ? 'gtar' : 'tar'
- PATCH_CMD =
SOLARIS_32 ? 'gpatch' : 'patch'
Instance Method Summary
collapse
Instance Method Details
#check_libmemcached ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'ext/rlibmemcached/extconf.rb', line 37
def check_libmemcached
return if ENV["EXTERNAL_LIB"]
Dir.chdir(LIBMEMCACHED_DIR) do
FileUtils.rm_rf("build")
run("#{GMAKE_CMD} clean 2>&1") if File.exist?("Makefile")
ts_now=Time.now.strftime("%Y%m%d%H%M.%S")
run("find . | xargs touch -t #{ts_now}", "Touching all files so autoconf doesn't run.")
Dir.mkdir("build")
build_folder = File.join(LIBMEMCACHED_DIR, "build")
run("env CFLAGS='-fPIC #{LIBM_CFLAGS}' LDFLAGS='-fPIC #{LIBM_LDFLAGS}' ./configure --prefix=#{build_folder} --libdir=#{build_folder}/lib --without-memcached --disable-shared --disable-utils --disable-dependency-tracking #{$CC} #{$EXTRA_CONF} 2>&1", "Configuring libmemcached.")
run("#{GMAKE_CMD} CXXFLAGS='#{$CXXFLAGS}' 2>&1")
run("#{GMAKE_CMD} install 2>&1")
pcfile = File.join(LIBMEMCACHED_DIR, "build", "lib", "pkgconfig", "libmemcached.pc")
$LDFLAGS << " -lsasl2 " + `pkg-config --libs --static #{pcfile}`.strip
end
$DEFLIBPATH.unshift("#{LIBMEMCACHED_DIR}/build")
dir_config('memcached', "#{LIBMEMCACHED_DIR}/build/include", "#{LIBMEMCACHED_DIR}/build/lib")
end
|
#run(cmd, reason = nil) ⇒ Object
64
65
66
67
68
|
# File 'ext/rlibmemcached/extconf.rb', line 64
def run(cmd, reason = nil)
puts reason if reason
puts cmd
raise "'#{cmd}' failed" unless system(cmd)
end
|