41 lines
781 B
Crystal
41 lines
781 B
Crystal
|
|
# Actual compilation instructions
|
|
#
|
|
# Backends:
|
|
# - make
|
|
# pass if no Makefile
|
|
|
|
class Package::Backend::Build
|
|
|
|
def self.make : Backend::Building
|
|
Backend::Building.new "build", "make" do |context, recipe|
|
|
unless Dir.exists? recipe.dirname
|
|
Baguette::Log.detail "no '#{recipe.dirname}' directory: pass"
|
|
next BuildStatus::Pass
|
|
end
|
|
Do.cd recipe.dirname
|
|
|
|
unless File.exists? "Makefile"
|
|
Baguette::Log.detail "no Makefile: pass"
|
|
next BuildStatus::Pass
|
|
end
|
|
|
|
ncores = recipe.options["build-cores"]? || context.build_cores
|
|
|
|
options = [
|
|
"-j#{ncores}",
|
|
recipe.options["make"]? || ""
|
|
]
|
|
|
|
child = Do.sh "make #{options.join " "}"
|
|
|
|
if child.exit_status == 0
|
|
BuildStatus::Success
|
|
else
|
|
BuildStatus::Failed
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|