48 lines
1.1 KiB
Crystal
48 lines
1.1 KiB
Crystal
|
|
class Package::Backend::Configure
|
|
|
|
def self.autotools : Backend::Building
|
|
Backend::Building.new "configure", "autotools" do |context, recipe|
|
|
next BuildStatus::Pass unless Dir.exists? recipe.dirname
|
|
|
|
Dir.cd recipe.dirname
|
|
|
|
unless File.exists? "configure"
|
|
next BuildStatus::Pass
|
|
end
|
|
|
|
child = Do.sh "./configure --prefix=#{recipe.prefix} #{recipe.options["configure"]? || ""}"
|
|
|
|
if child.exit_status == 0
|
|
BuildStatus::Success
|
|
else
|
|
BuildStatus::Failed
|
|
end
|
|
end
|
|
end
|
|
|
|
def self.cmake : Backend::Building
|
|
Backend::Building.new "configure", "cmake" do |context, recipe|
|
|
next BuildStatus::Pass unless Dir.exists? recipe.dirname
|
|
|
|
Dir.cd recipe.dirname
|
|
|
|
next BuildStatus::Pass unless File.exists? "CMakeLists.txt"
|
|
|
|
options = [
|
|
"-DCMAKE_INSTALL_PREFIX='#{recipe.prefix}'",
|
|
"-DCMAKE_BUILD_TYPE=Release #{recipe.options["cmake"]}",
|
|
"-- -j#{context.build_cores}"
|
|
]
|
|
|
|
child = Do.sh "cmake . #{options.join " "}"
|
|
if child.exit_status == 0
|
|
BuildStatus::Success
|
|
else
|
|
BuildStatus::Failed
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|