Sha256: 51be0b9e33351c2d4861cb9a3c5113321c2326d45c4b0354e92fbae6a9bcd4ff
Contents?: true
Size: 1.49 KB
Versions: 21
Compression:
Stored size: 1.49 KB
Contents
require 'fileutils' module PkgForge ## # Add build methods to Forge class Forge attr_writer :build_block Contract None => Proc def build_block @build_block ||= proc { raise 'No build block provided' } end Contract None => nil def build! prepare_source! patch_source! prepare_deps! builder = PkgForge::DSL::Build.new(self) builder.instance_eval(&build_block) end end module DSL ## # Add build method to Forge DSL class Forge Contract Func[None => nil] => nil def build(&block) @forge.build_block = block nil end end ## # Add build methods to Build DSL class Build Contract Or[String, Array], Or[HashOf[String => String], {}, nil] => nil def run(*args) @forge.run(*args) end Contract None => nil def configure env = { 'CC' => 'musl-gcc', 'CFLAGS' => @forge.cflags.join(' '), 'LIBS' => @forge.libs.join(' ') } run ['./configure'] + configure_flag_strings, env end Contract None => nil def make run 'make' end Contract None => nil def install run "make DESTDIR=#{@forge.releasedir} install" end Contract Or[String, ArrayOf[String]] => nil def rm(paths) paths = [paths] if paths.is_a? String paths.map { |x| File.join(@forge.releasedir, x) } FileUtils.rm_r paths nil end end end end
Version data entries
21 entries across 21 versions & 1 rubygems