Return to Snippet

Revision: 3481
at February 22, 2008 04:55 by felipec


Updated Code
class GnuPackage < BasePackage
  def initialize()
    super()

    @base = "#{@name}-${version}"
    @tarball = "#{@base}.tar.bz2"
    @url = "ftp://ftp.gnu.org/pub/gnu/#{@name}/#{@tarball}"
    @dir = @base
    @build_dir = "#{@name}-build"
  end

end

class BinutilsPackage < GnuPackage
  def initialize()
    @version = "2.17"
    @name = "binutils"
    super()

    @config_opts = "--disable-nls --with-sysroot=\"#{$sys_root}\" --enable-shared --disable-multilib"
  end

  def build
    block("build") do
      run "cd #{$build_dir}"
      run "mkdir -p #{@build_dir}"
      run "cd #{@build_dir}"
      configure "script" => "../#{@dir}/configure", "opts" => @config_opts
      run "make configure-host"
      run "make"
    end
  end

  def install
    block("install") do
      run "cd #{$build_dir}"
      run "cd #{@build_dir}"
      run "make install"
    end
  end
end

binutils = BinutilsPackage.new
binutils.download "/tmp"
binutils.extract
binutils.build
binutils.install

Revision: 3480
at July 30, 2007 15:54 by felipec


Initial Code
class Configure < Cmd
  def initialize( args = nil )
    @prefix = "/opt/cross"
    @host = "i386-linux"
    @target = "arm-linux"
    @script = "./configure"

    case args
    when Hash
      @prefix = args["prefix"] if args["prefix"]
      @script = args["script"] if args["script"]
    end

    opts = []
    opts << "--prefix=\"#{@prefix}\"" if @prefix
    opts << "--host=\"#{@host}\"" if @host
    opts << "--target=\"#{@target}\"" if @target
    opts << args["opts"] if args["opts"]

    @value = "#{@script} %s" % [opts.join(" ")]
    @note = "configuring"
  end
end

class BinutilsPackage < BasePackage
  def initialize()
    super()

    base = "binutils-2.17.tar.bz2"
    @url = "ftp://ftp.gnu.org/pub/gnu/binutils/#{base}"
    @tarball = "~/Desktop/#{base}"
    @dir = "binutils-2.17"
    @build_dir = "binutils-build"
  end

  def build
    build = Stage.new( "id" => "build", "note" => "building" )
    build.add( "cmd", "cd ~/src" )
    build.add( "cmd", "mkdir -p binutils-build" )
    build.add( "cmd", "cd binutils-build" )
    build.add( Configure.new(
        "script" => "../#{@dir}/configure",
        "opts" => "--disable-nls --with-sysroot=/opt/cross --enable-shared --disable-multilib" ) )
    build.add( "cmd", "make configure-host" )
    build.add( "cmd", "make" )
    build.do( @sh )
  end

  def install
    install = Stage.new( "id" => "install", "note" => "installing" )
    install.add( "cmd", "cd ~/src" )
    install.add( "cmd", "cd #{@build_dir}" )
    install.add( "cmd", "make install" )
    install.do( @sh )
  end
end

Initial URL

                                

Initial Description
Just an example of what I'm working on.

Initial Title
Sheller example

Initial Tags

                                

Initial Language
Ruby