Module: RCEE::Precompiled::ExtConf
- Defined in:
- ext/precompiled/extconf.rb
Constant Summary collapse
- PACKAGE_ROOT_DIR =
File.(File.join(File.dirname(__FILE__), "..", ".."))
Class Method Summary collapse
- .configure ⇒ Object
- .configure_cross_compilers ⇒ Object
- .configure_packaged_libraries ⇒ Object
- .cross_build? ⇒ Boolean
- .download ⇒ Object
- .libyaml_recipe ⇒ Object
Class Method Details
.configure ⇒ Object
10 11 12 13 14 |
# File 'ext/precompiled/extconf.rb', line 10 def configure configure_cross_compilers configure_packaged_libraries create_makefile("rcee/precompiled/precompiled") end |
.configure_cross_compilers ⇒ Object
16 17 18 19 |
# File 'ext/precompiled/extconf.rb', line 16 def configure_cross_compilers RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"] ENV["CC"] = RbConfig::CONFIG["CC"] end |
.configure_packaged_libraries ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'ext/precompiled/extconf.rb', line 21 def configure_packaged_libraries recipe = libyaml_recipe # pass some environment variables to the libyaml configuration for cross-compilation if cross_build? ENV.to_h.tap do |env| # -fPIC is necessary for linking into a shared library env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ") env["SUBDIRS"] = "include src" # libyaml: skip tests recipe. += env.map { |key, value| "#{key}=#{value.strip}" } end end # 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 recipe.activate pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc")) # 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 |
.cross_build? ⇒ Boolean
50 51 52 |
# File 'ext/precompiled/extconf.rb', line 50 def cross_build? enable_config("cross-build") end |
.download ⇒ Object
54 55 56 |
# File 'ext/precompiled/extconf.rb', line 54 def download libyaml_recipe.download end |
.libyaml_recipe ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'ext/precompiled/extconf.rb', line 58 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") end end |