Object
# File lib/mini_portile.rb, line 107 def activate lib_path = File.join(port_path, "lib") vars = { 'PATH' => File.join(port_path, 'bin'), 'CPATH' => File.join(port_path, 'include'), 'LIBRARY_PATH' => lib_path }.reject { |env, path| !File.directory?(path) } output "Activating #{@name} #{@version} (from #{port_path})..." vars.each do |var, path| full_path = File.expand_path(path) # turn into a valid Windows path (if required) full_path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR # save current variable value old_value = ENV[var] || '' unless old_value.include?(full_path) ENV[var] = "#{full_path}#{File::PATH_SEPARATOR}#{old_value}" end end # rely on LDFLAGS when cross-compiling if File.exist?(lib_path) && (@host != @original_host) full_path = File.expand_path(lib_path) old_value = ENV.fetch("LDFLAGS", "") unless old_value.include?(full_path) ENV["LDFLAGS"] = "-L#{full_path} #{old_value}".strip end end end
# File lib/mini_portile.rb, line 60 def compile execute('compile', 'make') end
# File lib/mini_portile.rb, line 50 def configure return if configured? md5_file = File.join(tmp_path, 'configure.md5') digest = Digest::MD5.hexdigest(computed_options) File.open(md5_file, "w") { |f| f.write digest } execute('configure', %(sh configure #{computed_options})) end
# File lib/mini_portile.rb, line 46 def configure_options @configure_options ||= configure_defaults end
# File lib/mini_portile.rb, line 78 def configured? configure = File.join(work_path, 'configure') makefile = File.join(work_path, 'Makefile') md5_file = File.join(tmp_path, 'configure.md5') stored_md5 = File.exist?(md5_file) ? File.read(md5_file) : "" current_md5 = Digest::MD5.hexdigest(computed_options) (current_md5 == stored_md5) && newer?(makefile, configure) end
# File lib/mini_portile.rb, line 96 def cook download unless downloaded? extract patch configure unless configured? compile install unless installed? return true end
# File lib/mini_portile.rb, line 24 def download @files.each do |url| filename = File.basename(url) download_file(url, File.join(archives_path, filename)) end end
# File lib/mini_portile.rb, line 69 def downloaded? missing = @files.detect do |url| filename = File.basename(url) !File.exist?(File.join(archives_path, filename)) end missing ? false : true end
# File lib/mini_portile.rb, line 31 def extract @files.each do |url| filename = File.basename(url) extract_file(File.join(archives_path, filename), tmp_path) end end
# File lib/mini_portile.rb, line 64 def install return if installed? execute('install', %(make install)) end
# File lib/mini_portile.rb, line 89 def installed? makefile = File.join(work_path, 'Makefile') target_dir = Dir.glob("#{port_path}/*").find { |d| File.directory?(d) } newer?(target_dir, makefile) end
Generated with the Darkfish Rdoc Generator 2.