Module: RCEE::PackagedTarball::ExtConf

Defined in:
ext/packaged_tarball/extconf.rb

Constant Summary collapse

PACKAGE_ROOT_DIR =
File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))

Class Method Summary collapse

Class Method Details

.configureObject



10
11
12
13
14
# File 'ext/packaged_tarball/extconf.rb', line 10

def configure
  configure_packaged_libraries

  create_makefile("rcee/packaged_tarball/packaged_tarball")
end

.configure_packaged_librariesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'ext/packaged_tarball/extconf.rb', line 16

def configure_packaged_libraries
  recipe = libyaml_recipe

  # ensure libyaml has already been unpacked, configured, and compiled
  unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
    recipe.cook
  end

  # use the packaged libyaml
  pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
  recipe.activate

  # assert that we can build against the packaged libyaml
  unless have_library("yaml", "yaml_get_version", "yaml.h")
    abort("\nERROR: *** could not find libyaml development environment ***\n\n")
  end
end

.downloadObject



34
35
36
# File 'ext/packaged_tarball/extconf.rb', line 34

def download
  libyaml_recipe.download
end

.libyaml_recipeObject



38
39
40
41
42
43
44
45
46
47
# File 'ext/packaged_tarball/extconf.rb', line 38

def libyaml_recipe
  MiniPortile.new("yaml", "0.2.5").tap do |recipe|
    recipe.files = [{
      url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
      sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4"
    }]
    recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
    recipe.host.gsub!(/^arm64-apple-darwin/, "aarch64-apple-darwin")
  end
end