Top Level Namespace
Defined Under Namespace
Modules: Nokolexbor
Classes: CMakeTimeout
Constant Summary
collapse
- MAKE =
if Gem.win_platform?
find_executable('make')
else
find_executable('gmake') || find_executable('make')
end
- CWD =
File.expand_path(File.dirname(__FILE__))
- LEXBOR_DIR =
File.join(CWD, '..', '..', 'vendor', 'lexbor')
- EXT_DIR =
File.join(CWD, '..', '..', 'ext', 'nokolexbor')
- INSTALL_DIR =
File.join(LEXBOR_DIR, 'dist')
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.run_cmake(timeout, args) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'ext/nokolexbor/extconf.rb', line 75
def self.run_cmake(timeout, args)
pgroup = (Gem.win_platform? && !ENV['NOKOLEXBOR_CROSS_COMPILE']) ? :new_pgroup : :pgroup
pid = Process.spawn("cmake #{args}", pgroup => true)
Timeout.timeout(timeout) do
Process.waitpid(pid)
end
rescue Timeout::Error
Process.kill(-9, pid)
Process.detach(pid)
raise CMakeTimeout.new("cmake has exceeded its timeout of #{timeout}s")
end
|
Instance Method Details
#apply_patch(patch_file, chdir) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'ext/nokolexbor/extconf.rb', line 93
def apply_patch(patch_file, chdir)
case
when which('git')
Process.waitpid(Process.spawn("git --git-dir=. --work-tree=. apply #{patch_file}", chdir: chdir))
when which('patch')
Process.waitpid(Process.spawn("patch -p1 -i #{patch_file}", chdir: chdir))
else
raise "Failed to complete patch task; patch(1) or git(1) is required."
end
end
|
#sys(cmd) ⇒ Object
63
64
65
66
67
68
69
|
# File 'ext/nokolexbor/extconf.rb', line 63
def sys(cmd)
puts "-- #{cmd}"
unless ret = xsystem(cmd)
raise "ERROR: '#{cmd}' failed"
end
ret
end
|
#which(cmd) ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'ext/nokolexbor/extconf.rb', line 12
def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each { |ext|
exe = File.join(path, "#{cmd}#{ext}")
return exe if File.executable? exe
}
end
return nil
end
|