Class: PkgForge::DSL::Build

Inherits:
Base
  • Object
show all
Defined in:
lib/pkgforge/components/dirs.rb,
lib/pkgforge/base.rb,
lib/pkgforge/components/build.rb,
lib/pkgforge/components/configure.rb

Overview

Add configure flag options to Build DSL

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from PkgForge::Base

Instance Method Details

#configureObject



44
45
46
47
48
49
50
51
# File 'lib/pkgforge/components/build.rb', line 44

def configure
  env = {
    'CC' => 'musl-gcc',
    'CFLAGS' => @forge.cflags.join(' '),
    'LIBS' => @forge.libs.join(' ')
  }
  run ['./configure'] + configure_flag_strings, env
end

#configure_flag_stringsObject



28
29
30
31
32
# File 'lib/pkgforge/components/configure.rb', line 28

def configure_flag_strings
  @forge.configure_flags.map do |flag, value|
    "--#{flag}#{'=' if value}#{value}"
  end
end

#installObject



59
60
61
# File 'lib/pkgforge/components/build.rb', line 59

def install
  run "make DESTDIR=#{@forge.releasedir} install"
end

#makeObject



54
55
56
# File 'lib/pkgforge/components/build.rb', line 54

def make
  run 'make'
end

#releasedirObject



45
46
47
# File 'lib/pkgforge/components/dirs.rb', line 45

def releasedir
  @forge.tmpdir(:release)
end

#rm(paths) ⇒ Object



64
65
66
67
68
69
# File 'lib/pkgforge/components/build.rb', line 64

def rm(paths)
  paths = [paths] if paths.is_a? String
  paths.map { |x| File.join(@forge.releasedir, x) }
  FileUtils.rm_r paths
  nil
end

#run(*args) ⇒ Object



39
40
41
# File 'lib/pkgforge/components/build.rb', line 39

def run(*args)
  @forge.run(*args)
end