balancetui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/exe/balance-install +133 -0
- metadata +39 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 90501c02493dcf8ef9901b2813c52d54d981bac35c196e93343c37606b8ffbac
|
|
4
|
+
data.tar.gz: 8884a0080fea2f572828c87a19c97ce9c14c319a0e9f7668345fbb78dc01519d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1581b54e0a66bedc3070c1534097a73948481e7745c6afe4fee8e1c2a2ec32639b9ed78c1e5fd8160cfb6251fce72153b430229bf6357b67d23fc040c57481c7
|
|
7
|
+
data.tar.gz: 46ad3ef34f46b432446d1693fd855b7107ced108b4667b2a51eb24491a5644cbd9ea0987bd56503dc76105a31447cdfb7c1d9de07d964e7a4680346120b5e8a1
|
data/exe/balance-install
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
#!/usr/bin/env ruby
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require "fileutils"
|
|
6
|
+
require "open3"
|
|
7
|
+
|
|
8
|
+
REPO = "https://github.com/qoddit/balance.git"
|
|
9
|
+
VERSION = ENV.fetch("BALANCE_VERSION", "beta-0.3.3")
|
|
10
|
+
PREFIX = File.join(Dir.home, ".local")
|
|
11
|
+
BIN_DIR = File.join(PREFIX, "bin")
|
|
12
|
+
WORK_DIR = File.join(Dir.home, ".cache", "balance-installer", VERSION)
|
|
13
|
+
|
|
14
|
+
def run!(*cmd)
|
|
15
|
+
puts "+ #{cmd.join(' ')}"
|
|
16
|
+
abort "Command failed: #{cmd.first}" unless system(*cmd)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def capture!(*cmd)
|
|
20
|
+
output, status = Open3.capture2(*cmd)
|
|
21
|
+
abort "Command failed: #{cmd.first}" unless status.success?
|
|
22
|
+
output.strip
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def linux?
|
|
26
|
+
RUBY_PLATFORM.include?("linux")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def macos?
|
|
30
|
+
RUBY_PLATFORM.include?("darwin")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def install_dependencies
|
|
34
|
+
if macos?
|
|
35
|
+
abort "Install Homebrew first: https://brew.sh" unless system(
|
|
36
|
+
"brew", "--version", out: File::NULL, err: File::NULL
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
unless system("xcode-select", "-p", out: File::NULL, err: File::NULL)
|
|
40
|
+
abort "Install Xcode Command Line Tools with: xcode-select --install"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
run!("brew", "install", "cmake", "git", "openssl@3", "curl", "ncurses")
|
|
44
|
+
|
|
45
|
+
elsif linux?
|
|
46
|
+
if File.exist?("/usr/bin/apt-get")
|
|
47
|
+
run!("sudo", "apt-get", "update")
|
|
48
|
+
run!("sudo", "apt-get", "install", "-y",
|
|
49
|
+
"build-essential", "cmake", "git", "pkg-config",
|
|
50
|
+
"libssl-dev", "libcurl4-openssl-dev", "libncurses-dev")
|
|
51
|
+
|
|
52
|
+
elsif File.exist?("/usr/bin/dnf")
|
|
53
|
+
run!("sudo", "dnf", "install", "-y",
|
|
54
|
+
"gcc", "make", "cmake", "git", "pkgconf-pkg-config",
|
|
55
|
+
"openssl-devel", "libcurl-devel", "ncurses-devel")
|
|
56
|
+
|
|
57
|
+
elsif File.exist?("/usr/bin/pacman")
|
|
58
|
+
run!("sudo", "pacman", "-S", "--needed", "--noconfirm",
|
|
59
|
+
"base-devel", "cmake", "git", "pkgconf",
|
|
60
|
+
"openssl", "curl", "ncurses")
|
|
61
|
+
|
|
62
|
+
elsif File.exist?("/usr/bin/zypper")
|
|
63
|
+
run!("sudo", "zypper", "install", "-y",
|
|
64
|
+
"gcc", "make", "cmake", "git", "pkg-config",
|
|
65
|
+
"libopenssl-devel", "libcurl-devel", "ncurses-devel")
|
|
66
|
+
|
|
67
|
+
else
|
|
68
|
+
abort "Unsupported Linux package manager. Install a C compiler, CMake, Git, pkg-config, OpenSSL 3, libcurl, and ncurses development packages manually."
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
abort "Unsupported OS: #{RUBY_PLATFORM}. Supported: macOS and Linux."
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def configure_and_build
|
|
76
|
+
source = File.join(WORK_DIR, "source")
|
|
77
|
+
build = File.join(WORK_DIR, "build")
|
|
78
|
+
|
|
79
|
+
FileUtils.mkdir_p(WORK_DIR)
|
|
80
|
+
|
|
81
|
+
if File.directory?(File.join(source, ".git"))
|
|
82
|
+
run!("git", "-C", source, "fetch", "--depth", "1", "origin", VERSION)
|
|
83
|
+
run!("git", "-C", source, "checkout", "--detach", "FETCH_HEAD")
|
|
84
|
+
else
|
|
85
|
+
run!("git", "clone", "--depth", "1", "--branch", VERSION,
|
|
86
|
+
REPO, source)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
args = [
|
|
90
|
+
"cmake", "-S", source, "-B", build,
|
|
91
|
+
"-DCMAKE_BUILD_TYPE=Release"
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
if macos?
|
|
95
|
+
openssl = capture!("brew", "--prefix", "openssl@3")
|
|
96
|
+
curl = capture!("brew", "--prefix", "curl")
|
|
97
|
+
ncurses = capture!("brew", "--prefix", "ncurses")
|
|
98
|
+
|
|
99
|
+
crypto = File.join(openssl, "lib", "libcrypto.dylib")
|
|
100
|
+
abort "OpenSSL library not found: #{crypto}" unless File.exist?(crypto)
|
|
101
|
+
|
|
102
|
+
args += [
|
|
103
|
+
"-DOPENSSL_ROOT_DIR=#{openssl}",
|
|
104
|
+
"-DOPENSSL_INCLUDE_DIR=#{File.join(openssl, 'include')}",
|
|
105
|
+
"-DOPENSSL_CRYPTO_LIBRARY=#{crypto}",
|
|
106
|
+
"-DCMAKE_PREFIX_PATH=#{curl};#{ncurses}"
|
|
107
|
+
]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
run!(*args)
|
|
111
|
+
run!("cmake", "--build", build, "--parallel")
|
|
112
|
+
run!("ctest", "--test-dir", build, "--output-on-failure")
|
|
113
|
+
|
|
114
|
+
executable = File.join(build, "balance")
|
|
115
|
+
abort "Build succeeded but executable was not found at #{executable}" unless
|
|
116
|
+
File.file?(executable)
|
|
117
|
+
|
|
118
|
+
FileUtils.mkdir_p(BIN_DIR)
|
|
119
|
+
destination = File.join(BIN_DIR, "balance")
|
|
120
|
+
FileUtils.install(executable, destination, mode: 0o755)
|
|
121
|
+
|
|
122
|
+
puts "\nBalance installed to: #{destination}"
|
|
123
|
+
|
|
124
|
+
unless ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).include?(BIN_DIR)
|
|
125
|
+
puts "Add this directory to your PATH if needed:"
|
|
126
|
+
puts " export PATH=\"$HOME/.local/bin:$PATH\""
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
puts "Run Balance with: balance"
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
install_dependencies
|
|
133
|
+
configure_and_build
|
metadata
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: balancetui
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Balance contributors
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Installs Balance and its native build dependencies on macOS and Linux.
|
|
13
|
+
executables:
|
|
14
|
+
- balance-install
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- exe/balance-install
|
|
19
|
+
licenses:
|
|
20
|
+
- MIT
|
|
21
|
+
metadata: {}
|
|
22
|
+
rdoc_options: []
|
|
23
|
+
require_paths:
|
|
24
|
+
- lib
|
|
25
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.0'
|
|
30
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
requirements: []
|
|
36
|
+
rubygems_version: 4.0.23
|
|
37
|
+
specification_version: 4
|
|
38
|
+
summary: Build and install Balance from source
|
|
39
|
+
test_files: []
|