mini_portile2 2.8.1 → 2.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/mini_portile2/mini_portile.rb +30 -14
- data/lib/mini_portile2/mini_portile_cmake.rb +13 -2
- data/lib/mini_portile2/version.rb +1 -1
- data/test/test_cmake.rb +41 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51973caa0015d6919e11d6e081cec2e26f146cf329e5f2ec9b34b97e1485d13a
|
4
|
+
data.tar.gz: e5a8eeb01caa0e047ba7d0c75e19e726b18aa8af4fa6fc89e40367671d8bc919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7711d008192576bddd38a396a372581cfff4e6e2ec48c95ac669c61db470bad9a9e508cf314ab6fa859069477262c1c8c7d30beb043d3ce6a571c80351ef0e79
|
7
|
+
data.tar.gz: 553bc5519d22489492ee5eb16c80048731523a1cf45e8f7eb3c2f5a29de9b0a61bfa350894cbd0a82a769c6972ddd1083deb379b262f53ea9092a6e4abb910cd
|
data/.github/workflows/ci.yml
CHANGED
@@ -25,7 +25,7 @@ jobs:
|
|
25
25
|
fail-fast: false
|
26
26
|
matrix:
|
27
27
|
platform: [ubuntu-latest, windows-latest, macos-latest]
|
28
|
-
ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "head"]
|
28
|
+
ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "head"]
|
29
29
|
runs-on: ${{ matrix.platform }}
|
30
30
|
steps:
|
31
31
|
- name: configure git crlf on windows
|
@@ -33,7 +33,7 @@ jobs:
|
|
33
33
|
run: |
|
34
34
|
git config --system core.autocrlf false
|
35
35
|
git config --system core.eol lf
|
36
|
-
- uses: actions/checkout@
|
36
|
+
- uses: actions/checkout@v3
|
37
37
|
- uses: MSP-Greg/setup-ruby-pkgs@v1
|
38
38
|
with:
|
39
39
|
apt-get: _update_ build-essential cmake
|
@@ -57,14 +57,14 @@ jobs:
|
|
57
57
|
run: |
|
58
58
|
git config --system core.autocrlf false
|
59
59
|
git config --system core.eol lf
|
60
|
-
- uses: actions/checkout@
|
60
|
+
- uses: actions/checkout@v3
|
61
61
|
- uses: MSP-Greg/setup-ruby-pkgs@v1
|
62
62
|
with:
|
63
63
|
apt-get: _update_ build-essential cmake
|
64
64
|
mingw: _upgrade_ cmake
|
65
65
|
ruby-version: ${{ matrix.ruby }}
|
66
66
|
bundler-cache: true
|
67
|
-
- uses: actions/cache@
|
67
|
+
- uses: actions/cache@v3
|
68
68
|
with:
|
69
69
|
path: examples/ports/archives
|
70
70
|
key: ${{ matrix.platform }}-examples-${{ hashFiles('examples/Rakefile') }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## mini_portile changelog
|
2
2
|
|
3
|
+
### 2.8.3 / 2023-07-18
|
4
|
+
|
5
|
+
#### Fixed
|
6
|
+
|
7
|
+
- cmake: only use MSYS/NMake generators when available. [#129] (Thanks, @stanhu!)
|
8
|
+
|
9
|
+
|
10
|
+
### 2.8.2 / 2023-04-30
|
11
|
+
|
12
|
+
#### Fixed
|
13
|
+
|
14
|
+
- Ensure that the `source_directory` option will work when given a Windows path to an autoconf directory. [#126]
|
15
|
+
|
16
|
+
|
3
17
|
### 2.8.1 / 2022-12-24
|
4
18
|
|
5
19
|
#### Fixed
|
@@ -67,12 +67,12 @@ class MiniPortile
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def source_directory=(path)
|
70
|
-
@source_directory =
|
70
|
+
@source_directory = posix_path(path)
|
71
71
|
end
|
72
72
|
|
73
73
|
def prepare_build_directory
|
74
74
|
raise "source_directory is not set" if source_directory.nil?
|
75
|
-
output "Building #{@name}
|
75
|
+
output "Building #{@name} from source at '#{source_directory}'"
|
76
76
|
FileUtils.mkdir_p(File.join(tmp_path, [name, version].join("-")))
|
77
77
|
FileUtils.rm_rf(port_path) # make sure we always re-install
|
78
78
|
end
|
@@ -137,7 +137,7 @@ class MiniPortile
|
|
137
137
|
# Windows doesn't recognize the shebang.
|
138
138
|
command.unshift("sh")
|
139
139
|
end
|
140
|
-
execute('configure', command + computed_options)
|
140
|
+
execute('configure', command + computed_options, altlog: "config.log")
|
141
141
|
end
|
142
142
|
|
143
143
|
def compile
|
@@ -200,10 +200,7 @@ class MiniPortile
|
|
200
200
|
|
201
201
|
output "Activating #{@name} #{@version} (from #{port_path})..."
|
202
202
|
vars.each do |var, path|
|
203
|
-
full_path =
|
204
|
-
|
205
|
-
# turn into a valid Windows path (if required)
|
206
|
-
full_path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
|
203
|
+
full_path = native_path(path)
|
207
204
|
|
208
205
|
# save current variable value
|
209
206
|
old_value = ENV[var] || ''
|
@@ -237,7 +234,25 @@ class MiniPortile
|
|
237
234
|
(ENV["MAKE"] || @make_command || ENV["make"] || "make").dup
|
238
235
|
end
|
239
236
|
|
240
|
-
private
|
237
|
+
private
|
238
|
+
|
239
|
+
def native_path(path)
|
240
|
+
path = File.expand_path(path)
|
241
|
+
if File::ALT_SEPARATOR
|
242
|
+
path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
243
|
+
else
|
244
|
+
path
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def posix_path(path)
|
249
|
+
path = File.expand_path(path)
|
250
|
+
if File::ALT_SEPARATOR
|
251
|
+
"/" + path.tr(File::ALT_SEPARATOR, File::SEPARATOR).tr(":", File::SEPARATOR)
|
252
|
+
else
|
253
|
+
path
|
254
|
+
end
|
255
|
+
end
|
241
256
|
|
242
257
|
def tmp_path
|
243
258
|
"tmp/#{@host}/ports/#{@name}/#{@version}"
|
@@ -420,6 +435,7 @@ private
|
|
420
435
|
opt_debug = command_opts.fetch(:debug, false)
|
421
436
|
opt_cd = command_opts.fetch(:cd) { work_path }
|
422
437
|
opt_env = command_opts.fetch(:env) { Hash.new }
|
438
|
+
opt_altlog = command_opts.fetch(:altlog, nil)
|
423
439
|
|
424
440
|
log_out = log_file(action)
|
425
441
|
|
@@ -450,12 +466,12 @@ private
|
|
450
466
|
output "OK"
|
451
467
|
return true
|
452
468
|
else
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
output(
|
458
|
-
output("
|
469
|
+
output "ERROR. Please review logs to see what happened:\n"
|
470
|
+
[log_out, opt_altlog].compact.each do |log|
|
471
|
+
next unless File.exist?(log)
|
472
|
+
output("----- contents of '#{log}' -----")
|
473
|
+
output(File.read(log))
|
474
|
+
output("----- end of file -----")
|
459
475
|
end
|
460
476
|
raise "Failed to complete #{action} task"
|
461
477
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'mini_portile2/mini_portile'
|
2
|
+
require 'open3'
|
2
3
|
|
3
4
|
class MiniPortileCMake < MiniPortile
|
4
5
|
def configure_prefix
|
@@ -11,9 +12,9 @@ class MiniPortileCMake < MiniPortile
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def configure_defaults
|
14
|
-
if MiniPortile.mswin?
|
15
|
+
if MiniPortile.mswin? && generator_available?('NMake')
|
15
16
|
['-G', 'NMake Makefiles']
|
16
|
-
elsif MiniPortile.mingw?
|
17
|
+
elsif MiniPortile.mingw? && generator_available?('MSYS')
|
17
18
|
['-G', 'MSYS Makefiles']
|
18
19
|
else
|
19
20
|
[]
|
@@ -48,4 +49,14 @@ class MiniPortileCMake < MiniPortile
|
|
48
49
|
def cmake_cmd
|
49
50
|
(ENV["CMAKE"] || @cmake_command || "cmake").dup
|
50
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def generator_available?(generator_type)
|
56
|
+
stdout_str, status = Open3.capture2("#{cmake_cmd} --help")
|
57
|
+
|
58
|
+
raise 'Unable to determine whether CMake supports #{generator_type} Makefile generator' unless status.success?
|
59
|
+
|
60
|
+
stdout_str.include?("#{generator_type} Makefiles")
|
61
|
+
end
|
51
62
|
end
|
data/test/test_cmake.rb
CHANGED
@@ -59,7 +59,7 @@ class TestCMake < TestCase
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
class TestCMakeConfig <
|
62
|
+
class TestCMakeConfig < TestCMake
|
63
63
|
def test_make_command_configuration
|
64
64
|
MiniPortile.stub(:mswin?, false) do
|
65
65
|
without_env("MAKE") do
|
@@ -77,6 +77,30 @@ class TestCMakeConfig < TestCase
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
def test_configure_defaults_with_unix_makefiles
|
81
|
+
Open3.stub(:capture2, cmake_help_mock('Unix')) do
|
82
|
+
MiniPortile.stub(:mingw?, true) do
|
83
|
+
assert_equal([], @recipe.configure_defaults)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_configure_defaults_with_msys_makefiles
|
89
|
+
Open3.stub(:capture2, cmake_help_mock('MSYS')) do
|
90
|
+
MiniPortile.stub(:mingw?, true) do
|
91
|
+
assert_equal(['-G', 'MSYS Makefiles'], @recipe.configure_defaults)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_configure_defaults_with_nmake_makefiles
|
97
|
+
Open3.stub(:capture2, cmake_help_mock('NMake')) do
|
98
|
+
MiniPortile.stub(:mswin?, true) do
|
99
|
+
assert_equal(['-G', 'NMake Makefiles'], @recipe.configure_defaults)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
80
104
|
def test_cmake_command_configuration
|
81
105
|
without_env("CMAKE") do
|
82
106
|
assert_equal("cmake", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
|
@@ -87,4 +111,20 @@ class TestCMakeConfig < TestCase
|
|
87
111
|
assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
|
88
112
|
end
|
89
113
|
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def cmake_help_mock(generator_type)
|
118
|
+
open3_mock = MiniTest::Mock.new
|
119
|
+
cmake_script = <<~SCRIPT
|
120
|
+
echo "The following generators are available on this platform (* marks default):"
|
121
|
+
echo "* #{generator_type} Makefiles = Generates standard #{generator_type.upcase} makefiles."
|
122
|
+
SCRIPT
|
123
|
+
|
124
|
+
exit_status = MiniTest::Mock.new
|
125
|
+
exit_status.expect(:success?, true)
|
126
|
+
expected_output = [cmake_script, exit_status]
|
127
|
+
open3_mock.expect(:call, expected_output, ['cmake --help'])
|
128
|
+
open3_mock
|
129
|
+
end
|
90
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_portile2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.4.10
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Simplistic port-like solution for developers
|