Recipe#options

master
Luka Vandervelden 2019-07-23 16:41:34 +02:00
parent a066d39918
commit d80e1f12b3
2 changed files with 8 additions and 3 deletions

View File

@ -90,7 +90,7 @@ class Package::Context
next BuildStatus::Pass next BuildStatus::Pass
end end
child = context.run "./configure", ["--prefix=/usr"] child = context.sh "./configure --prefix=/usr #{recipe.options["configure"]? || ""}"
if child.exit_status == 0 if child.exit_status == 0
BuildStatus::Success BuildStatus::Success
@ -106,7 +106,7 @@ class Package::Context
next BuildStatus::Pass next BuildStatus::Pass
end end
child = context.run "make" child = context.sh "make #{recipe.options["make"]? || ""}"
if child.exit_status == 0 if child.exit_status == 0
BuildStatus::Success BuildStatus::Success
@ -122,7 +122,7 @@ class Package::Context
next BuildStatus::Pass next BuildStatus::Pass
end end
child = context.run "make", ["install", "DESTDIR=#{recipe.fake_root_directory}"] child = context.sh "make install 'DESTDIR=#{recipe.fake_root_directory}' #{recipe.options["make install"]? || ""}"
if child.exit_status == 0 if child.exit_status == 0
BuildStatus::Success BuildStatus::Success
@ -166,6 +166,10 @@ class Package::Context
run nil, command, nil run nil, command, nil
end end
def sh(command)
run nil, "sh", ["-x", "-e", "-c", command]
end
def package(package : Package) : Bool def package(package : Package) : Bool
@selected_packaging_backend.package self, package @selected_packaging_backend.package self, package
end end

View File

@ -43,6 +43,7 @@ class Package::Recipe
# Build instructions, helpers and other build-only data. # Build instructions, helpers and other build-only data.
setter dirname : String? # matching getter defined manually later. setter dirname : String? # matching getter defined manually later.
getter instructions = Instructions.new getter instructions = Instructions.new
getter options = Hash(String, String).new
def initialize(@context, @name, @version) def initialize(@context, @name, @version)
@sources = Sources.new @sources = Sources.new