Sha256: 07b43db5b02e2240135e54bd97a6ea265fc299bfdea00b7207edc9ca700a93eb

Contents?: true

Size: 1011 Bytes

Versions: 5

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true

require "mkmf"

def sys(cmd)
  puts " -- #{cmd}"
  unless ret = xsystem(cmd)
    raise "ERROR: '#{cmd}' failed"
  end
  ret
end

def run_cmake(args)
  pid = Process.spawn("cmake #{args}")
  Process.waitpid(pid)
end

if !find_executable("cmake")
  abort "ERROR: CMake is required to build ob64"
end

MAKE = find_executable("make") || find_executable("gmake")
if !MAKE
  abort "ERROR: make is required to build ob64"
end

CWD = __dir__
LIBBASE64_DIR = File.join(CWD, "..", "..", "vendor", "libbase64")

Dir.chdir(LIBBASE64_DIR) do
  Dir.mkdir("build") unless Dir.exist?("build")

  Dir.chdir("build") do
    run_cmake(".. -DBUILD_SHARED_LIBS=true -DOPENMP=false")
    sys(MAKE)
  end

  $DEFLIBPATH.unshift("#{LIBBASE64_DIR}/build/bin")
  dir_config("base64", "#{LIBBASE64_DIR}/include", "#{LIBBASE64_DIR}/build/bin")
end

unless have_library("base64") && have_header("libbase64.h")
  abort "ERROR: Failed to build libbase64"
end

dir_config("ob64_ext")
create_makefile("ob64_ext")

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ob64-0.5.0 ext/ob64/extconf.rb
ob64-0.4.0 ext/ob64/extconf.rb
ob64-0.3.0 ext/ob64/extconf.rb
ob64-0.2.0 ext/ob64/extconf.rb
ob64-0.1.0 ext/ob64/extconf.rb