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"] || []
|
@steps = makefile["steps"] || []
|
||||||
|
|
||||||
@environment = ENV.to_h.merge(
|
@environment = ENV.to_h.merge(
|
||||||
"PREFIX" => get_prefix
|
"PREFIX" => get_prefix,
|
||||||
|
"CPUS" => System.cpus.to_s,
|
||||||
|
"SUDO" => (@target == :user ? "" : "sudo")
|
||||||
)
|
)
|
||||||
|
|
||||||
environment = makefile["environment"]
|
environment = makefile["environment"]
|
||||||
|
@ -69,13 +71,22 @@ module Make
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_prefix
|
def get_prefix
|
||||||
|
sys_prefix = case System.os_name
|
||||||
|
when :macos
|
||||||
|
"/usr"
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
|
|
||||||
case @target
|
case @target
|
||||||
when :user
|
when :user
|
||||||
"#{ENV["HOME"]}/.local"
|
"#{ENV["HOME"]}/.local"
|
||||||
when :package
|
when :package
|
||||||
"/pkg/#{@name}/#{@repository.branch}"
|
"#{sys_prefix}/pkg/#{@name}/#{@repository.branch}"
|
||||||
when :system
|
when :system
|
||||||
"/"
|
"#{sys_prefix}/"
|
||||||
|
else
|
||||||
|
raise "Unknown target: #{@target.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
|
require 'open3'
|
||||||
|
|
||||||
module DebianSystem
|
module DebianSystem
|
||||||
def os_name
|
def os_name
|
||||||
"Debian Linux"
|
"Debian Linux"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cpus
|
||||||
|
stdout, stderr, status = Open3.capture3("nproc")
|
||||||
|
stdout.strip.to_i
|
||||||
|
end
|
||||||
|
|
||||||
def install(packages)
|
def install(packages)
|
||||||
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
|
require 'open3'
|
||||||
|
|
||||||
module MacOSSystem
|
module MacOSSystem
|
||||||
def os_name
|
def os_name
|
||||||
"macOS"
|
"macOS"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cpus
|
||||||
|
stdout, stderr, status = Open3.capture3("sysctl -n hw.ncpu")
|
||||||
|
stdout.strip.to_i
|
||||||
|
end
|
||||||
|
|
||||||
def install(packages)
|
def install(packages)
|
||||||
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
missing_packages = packages.reject { |pkg| package_installed?(pkg) }
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ repository:
|
||||||
branch: main
|
branch: main
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- echo installing in $PREFIX
|
- echo installing in $PREFIX and cpus $CPUS
|
||||||
- cd $WORK_DIR
|
- cd $WORK_DIR
|
||||||
- ls
|
- ls
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ repository:
|
||||||
branch: v3.13.5
|
branch: v3.13.5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- ./configure --enable-optimizations --prefix=$HOME/.local
|
# dat make -t pkg --cache --name python
|
||||||
- make -j"$(nproc)"
|
# - ./configure --enable-optimizations --prefix=$HOME/.local
|
||||||
- make install
|
# - 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-readline-dir=$(brew --prefix readline)
|
||||||
# --with-yaml-dir=$(brew --prefix libyaml)
|
# --with-yaml-dir=$(brew --prefix libyaml)
|
||||||
- make -j$(sysctl -n hw.ncpu)
|
- make -j$(sysctl -n hw.ncpu)
|
||||||
- make install
|
- make install
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue