This commit is contained in:
Artur Gurgul 2025-08-03 14:47:59 +02:00
parent 0c98334d1c
commit 9e900d3b79
6 changed files with 36 additions and 8 deletions

View file

@ -56,7 +56,9 @@ module Make
@steps = makefile["steps"] || []
@environment = ENV.to_h.merge(
"PREFIX" => get_prefix
"PREFIX" => get_prefix,
"CPUS" => System.cpus.to_s,
"SUDO" => (@target == :user ? "" : "sudo")
)
environment = makefile["environment"]
@ -69,13 +71,22 @@ module Make
end
def get_prefix
sys_prefix = case System.os_name
when :macos
"/usr"
else
""
end
case @target
when :user
"#{ENV["HOME"]}/.local"
when :package
"/pkg/#{@name}/#{@repository.branch}"
"#{sys_prefix}/pkg/#{@name}/#{@repository.branch}"
when :system
"/"
"#{sys_prefix}/"
else
raise "Unknown target: #{@target.inspect}"
end
end