Class: BuildRecipe
- Inherits:
-
MiniPortile
- Object
- MiniPortile
- BuildRecipe
- Defined in:
- ext/tiny_tds/extconf.rb
Instance Method Summary collapse
-
#chdir_for_build ⇒ Object
When using rake-compiler-dock on Windows, the underlying Virtualbox shared folders don’t support symlinks, but libiconv expects it for a build on Linux.
- #configure_defaults ⇒ Object
- #consolidated_host(name) ⇒ Object
- #cook_and_activate ⇒ Object
-
#initialize(name, version, files) ⇒ BuildRecipe
constructor
A new instance of BuildRecipe.
- #port_path ⇒ Object
Constructor Details
#initialize(name, version, files) ⇒ BuildRecipe
Returns a new instance of BuildRecipe.
89 90 91 92 93 94 95 96 97 |
# File 'ext/tiny_tds/extconf.rb', line 89 def initialize(name, version, files) super(name, version) self.files = files self.target = File.('../../../ports', __FILE__) # Prefer host_alias over host in order to use i586-mingw32msvc as # correct compiler prefix for cross build, but use host if not set. self.host = consolidated_host(RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]) self.patch_files = Dir[File.join(self.target, "patches", self.name, self.version, "*.diff")].sort end |
Instance Method Details
#chdir_for_build ⇒ Object
When using rake-compiler-dock on Windows, the underlying Virtualbox shared folders don’t support symlinks, but libiconv expects it for a build on Linux. We work around this limitation by using the temp dir for cooking.
121 122 123 124 125 126 |
# File 'ext/tiny_tds/extconf.rb', line 121 def chdir_for_build build_dir = ENV['RCD_HOST_RUBY_PLATFORM'].to_s =~ /mingw|mswin|cygwin/ ? '/tmp' : '.' Dir.chdir(build_dir) do yield end end |
#configure_defaults ⇒ Object
106 107 108 109 110 111 112 |
# File 'ext/tiny_tds/extconf.rb', line 106 def configure_defaults [ "--host=#{host}", # build for specific target (host) "--disable-static", "--enable-shared", ] end |
#consolidated_host(name) ⇒ Object
99 100 101 102 103 104 |
# File 'ext/tiny_tds/extconf.rb', line 99 def consolidated_host(name) # For ruby-1.9.3 we use newer mingw-w64 (i686-w64-mingw32) to build the shared libraries # and mingw32 (i586-mingw32msvc) to build the extension. name.gsub('i586-mingw32msvc', 'i686-w64-mingw32'). gsub('i686-pc-mingw32', 'i686-w64-mingw32') end |
#cook_and_activate ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 |
# File 'ext/tiny_tds/extconf.rb', line 128 def cook_and_activate checkpoint = File.join(self.target, "#{self.name}-#{self.version}-#{self.host}.installed") unless File.exist?(checkpoint) chdir_for_build do self.cook end FileUtils.touch checkpoint end self.activate self end |
#port_path ⇒ Object
114 115 116 |
# File 'ext/tiny_tds/extconf.rb', line 114 def port_path "#{target}/#{host}" end |