# File lib/autobuild/package.rb, line 45
    def initialize(spec)
        @dependencies   = Array.new
        @provides       = Array.new

        if Hash === spec
            name, depends = spec.to_a.first
        else
            name, depends = spec, nil
        end

        name = name.to_s
        @name = name
        raise ConfigException, "package #{name} is already defined" if Package[name]
        @@packages[name] = self

        # Call the config block (if any)
        yield(self) if block_given?
        
        # Declare the installation stampfile
        file installstamp
        task "#{name}-build" => installstamp
        task :build => "#{name}-build"

        # Add dependencies declared in spec
        depends_on *depends if depends

        # Define the import task
        task "#{name}-import" do import end
        task :import => "#{name}-import"

        # Define the prepare task
        task "#{name}-prepare" do prepare end
        task :prepare => "#{name}-prepare"

        task(name) do
            Rake::Task["#{name}-import"].invoke
            Rake::Task["#{name}-prepare"].invoke
            Rake::Task["#{name}-build"].invoke
        end
        task :default => name
    end