File: extconf.rb

package info (click to toggle)
ruby-tokyocabinet 1.31-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,636 kB
  • ctags: 942
  • sloc: ruby: 3,594; ansic: 3,387; sh: 29; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require "mkmf"

dir_config('tokyocabinet')

File::unlink("Makefile") if (File::exist?("Makefile"))

home = ENV["HOME"]
ENV["PATH"] = ENV["PATH"] + ":/usr/local/bin:$home/bin:."
tccflags = `tcucodec conf -i 2>/dev/null`.chomp
tcldflags = `tcucodec conf -l 2>/dev/null`.chomp
tcldflags = tcldflags.gsub(/-l[\S]+/, "").strip
tclibs = `tcucodec conf -l 2>/dev/null`.chomp
tclibs = tclibs.gsub(/-L[\S]+/, "").strip

tccflags = "-I/usr/local/include" if(tccflags.length < 1)
tcldflags = "-L/usr/local/lib" if(tcldflags.length < 1)
tclibs = "-ltokyocabinet -lz -lbz2 -lpthread -lm -lc" if(tclibs.length < 1)

$CFLAGS = "-I. #{tccflags} -Wall #{$CFLAGS} -O2"
$LDFLAGS = "#{$LDFLAGS} -L. #{tcldflags}"
$libs = "#{$libs} #{tclibs}"

printf("setting variables ...\n")
printf("  \$CFLAGS = %s\n", $CFLAGS)
printf("  \$LDFLAGS = %s\n", $LDFLAGS)
printf("  \$libs = %s\n", $libs)

if have_header('tcutil.h')
  create_makefile('tokyocabinet')
end