Parent

ExternalProject

An external project is typically a third-party library dependency that does not use makeconf for it's build system.

Attributes

patch[RW]
uri[RW]

Public Class Methods

new(options) click to toggle source
# File lib/makeconf/externalproject.rb, line 11
def initialize(options)
  # KLUDGE - parent constructor will barf unless we delete our 
  #       custom options
  @uri = options[:uri]
  options.delete :uri
  @configure = options[:configure]  # options passed to ./configure 
  options.delete :configure
  @configure = './configure' if @configure.nil?
  @patch = options[:patch]
  options.delete :patch
  @patch = [] if @patch.nil?

  super(options)

  @installable = false
  @distributable = false
end

Public Instance Methods

compile(cc) click to toggle source
# File lib/makeconf/externalproject.rb, line 68
def compile(cc)
   makefile = Makefile.new
   return makefile unless @buildable
   makefile.add_dependency('all', "#{@id}-build-stamp")
   makefile.add_target("#{@id}-build-stamp", [], 
           [
           "cd #{@id} && make",
           "touch #{@id}-build-stamp",
           ])
   makefile.add_rule('check', [ "cd #{@id} && make check" ])
   makefile.add_rule('clean', Platform.rm("#{@id}-build-stamp"))
   makefile
end
configure() click to toggle source

Examine the operating environment and set configuration options

# File lib/makeconf/externalproject.rb, line 30
def configure
  printf "checking for external project #{@id}... "
  if File.exists?(@id)
     puts "yes"
  else
    puts "no"
    download

    # Apply patches
    @patch.each do |p|
      system "cd #{@id} && patch -p0 -N < ../#{p}"              or throw "failed to apply patch: ../#{p}"
    end
  end

  # KLUDGE: passthrough certain options
  passthru = []
  Makeconf.original_argv.each do |x|
    passthru.push x if x =~ /^--(host|with-ndk|with-sdk)/
  end
  @configure += ' ' + passthru.join(' ') unless passthru.empty?

  # FIXME: this works, but autotools differ widely across host systems.
  #        make this an optional step that can be done
  #
  # Regenerate the Autotools files
  #if File.exists?(@id + '/configure.ac')
  #      system "cd #{@id} && autoreconf -fvi" \
  #          or throw "autoreconf failed"
  #    end

  # Run the autoconf-style ./configure script
  puts "*** Configuring #{@id} using #{@configure}"
  system "cd #{@id} && #{@configure}"          or throw "Unable to configure #{@id}"
  puts "*** Done"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.