save
This commit is contained in:
parent
0c98334d1c
commit
9e900d3b79
6 changed files with 36 additions and 8 deletions
17
lib/make.rb
17
lib/make.rb
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
require 'open3'
|
||||
|
||||
module DebianSystem
|
||||
def os_name
|
||||
"Debian Linux"
|
||||
end
|
||||
|
||||
def cpus
|
||||
stdout, stderr, status = Open3.capture3("nproc")
|
||||
stdout.strip.to_i
|
||||
end
|
||||
|
||||
def install(packages)
|
||||
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
require 'open3'
|
||||
|
||||
module MacOSSystem
|
||||
def os_name
|
||||
"macOS"
|
||||
end
|
||||
|
||||
def cpus
|
||||
stdout, stderr, status = Open3.capture3("sysctl -n hw.ncpu")
|
||||
stdout.strip.to_i
|
||||
end
|
||||
|
||||
def install(packages)
|
||||
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ repository:
|
|||
branch: main
|
||||
|
||||
steps:
|
||||
- echo installing in $PREFIX
|
||||
- echo installing in $PREFIX and cpus $CPUS
|
||||
- cd $WORK_DIR
|
||||
- ls
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ repository:
|
|||
branch: v3.13.5
|
||||
|
||||
steps:
|
||||
- ./configure --enable-optimizations --prefix=$HOME/.local
|
||||
- make -j"$(nproc)"
|
||||
- make install
|
||||
# dat make -t pkg --cache --name python
|
||||
# - ./configure --enable-optimizations --prefix=$HOME/.local
|
||||
# - make -j"$(nproc)"
|
||||
- ./configure --enable-optimizations --prefix=$PREFIX
|
||||
- make -j$CPUS
|
||||
- $SUDO make install
|
||||
|
|
|
@ -19,4 +19,4 @@ steps:
|
|||
# --with-readline-dir=$(brew --prefix readline)
|
||||
# --with-yaml-dir=$(brew --prefix libyaml)
|
||||
- make -j$(sysctl -n hw.ncpu)
|
||||
- make install
|
||||
- make install
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue