Top Level Namespace
Defined Under Namespace
Modules: Rbkit
Constant Summary collapse
- CWD =
File.('../', __FILE__)
Instance Method Summary collapse
- #download_and_install_msgpack_from_source ⇒ Object
- #download_and_install_zeromq_from_source ⇒ Object
- #download_file(url) ⇒ Object
- #green(str) ⇒ Object
- #red(str) ⇒ Object
Instance Method Details
#download_and_install_msgpack_from_source ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'ext/extconf.rb', line 47 def download_and_install_msgpack_from_source url = "https://github.com/msgpack/msgpack-c/releases/download/cpp-0.5.9/msgpack-0.5.9.tar.gz" filename = "msgpack-0.5.9.tar.gz" basename = File.basename(filename, '.tar.gz') dist_path = "#{CWD}/#{basename}/dist" unless File.exists? "#{dist_path}/lib/libmsgpack.a" puts green("Downloading and installing msgpack from source") download_file(url) system("tar zxvf #{filename}") Dir.chdir(basename) do system("./configure CFLAGS='-fPIC' --prefix='#{dist_path}'") system("cd src && make && make install") end end FileUtils.cp "#{dist_path}/lib/libmsgpack.a", "#{CWD}/libmsgpack.a" $INCFLAGS[0,0] = "-I#{dist_path}/include " end |
#download_and_install_zeromq_from_source ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'ext/extconf.rb', line 25 def download_and_install_zeromq_from_source url = "http://download.zeromq.org/zeromq-4.0.4.tar.gz" filename = "zeromq-4.0.4.tar.gz" basename = File.basename(filename, '.tar.gz') dist_path = "#{CWD}/#{basename}/dist" unless File.exists? "#{dist_path}/lib/libzmq.a" ['libtool', 'autoconf', 'automake'].each do |executable| fail "#{executable} needed by zeromq not found." unless find_executable(executable) end puts green("Downloading and installing zeromq from source") download_file(url) system("tar zxvf #{filename}") Dir.chdir(basename) do system("./configure CPPFLAGS='-fPIC' --prefix='#{dist_path}'") system("cd src && make && make install") end end FileUtils.cp "#{dist_path}/lib/libzmq.a", "#{CWD}/libzmq.a" $INCFLAGS[0,0] = "-I#{dist_path}/include " end |
#download_file(url) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'ext/extconf.rb', line 15 def download_file(url) if find_executable('curl') system("curl -L -O #{url}") elsif find_executable('wget') system("wget #{url}") else fail "Cannot download #{url}. You need either curl or wget to continue" end end |
#green(str) ⇒ Object
7 |
# File 'ext/extconf.rb', line 7 def green(str); "\033[32m#{str}\033[0m" end |
#red(str) ⇒ Object
6 |
# File 'ext/extconf.rb', line 6 def red(str); "\033[31m#{str}\033[0m" end |