mini_portile2 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cce9a4c5c119fbab9f241aae304d9aec171a69873a168688132d55e4010ee49
4
- data.tar.gz: eb61f44c46b6822aae38027d6c4aecb3c16d6b8d6e7caf008d90110da98c1d69
3
+ metadata.gz: 6c8eb702f252f0d5becb6655bfc84fb67220c71c9efb3b33a0e25d86b508e733
4
+ data.tar.gz: 3be4b50bfbc904e134928aed8d4e42a124a9931d8c16ee0f5c6ee3b81749c1d1
5
5
  SHA512:
6
- metadata.gz: c943d0ce63b54f9199426af7658f200054a87d151ff30b66183a5afa10096955733bab9a7ccaa167a9052e3826243d779e0579ded63ed1ea2522d35ab5940512
7
- data.tar.gz: 476d783710ca21b2893256f39a34f4f958a289ece0230eb7e364f4b1c0714e39f85c74f5f84783279685953ac179fc899959c0fb7302f41856720ceefdb33436
6
+ metadata.gz: bcd57ca484c13860e745aeaa732ee89c47fef3f8950826ae1de2ceaf773972f9f4208a06929b0f5bdbf9dbad775b6a63c21f9057a18da1bef733e2de59b16406
7
+ data.tar.gz: 3ba020aaed5610663ca00690625f0c3e62b8c62646bd98ec7b8b51fb7b77471991e651debe261d6a73861bea92589212111a38296af1482e498bae3711592698
@@ -1,5 +1,7 @@
1
1
  name: Continuous Integration
2
-
2
+ concurrency:
3
+ group: "${{github.workflow}}-${{github.ref}}"
4
+ cancel-in-progress: true
3
5
  on:
4
6
  workflow_dispatch:
5
7
  push:
@@ -20,6 +22,7 @@ jobs:
20
22
  env:
21
23
  MAKEFLAGS: -j2
22
24
  strategy:
25
+ fail-fast: false
23
26
  matrix:
24
27
  platform: [ubuntu-latest, windows-latest]
25
28
  ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "head"]
@@ -43,6 +46,7 @@ jobs:
43
46
  env:
44
47
  MAKEFLAGS: -j2
45
48
  strategy:
49
+ fail-fast: false
46
50
  matrix:
47
51
  platform: [ubuntu-latest, windows-latest]
48
52
  ruby: ["3.0"]
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## mini_portile changelog
2
2
 
3
+ ### 2.7.0 / 2021-08-31
4
+
5
+ ### Added
6
+
7
+ The commands used for "make", "compile", and "cmake" are configurable via keyword arguments. [#107] (Thanks, @cosmo0920!)
8
+
9
+
3
10
  ### 2.6.1 / 2021-05-31
4
11
 
5
12
  #### Dependencies
data/README.md CHANGED
@@ -83,11 +83,60 @@ library into a namespaced structure.
83
83
  `#activate` ensures GCC will find this library and prefer it over a
84
84
  system-wide installation.
85
85
 
86
+ Some keyword arguments can be passed to the constructor to configure the commands used:
87
+
88
+ #### `gcc_command`
89
+
90
+ The compiler command that is used is configurable, and in order of preference will use:
91
+
92
+ - the `CC` environment variable (if present)
93
+ - the `gcc_command` value passed in to the constructor
94
+ - `RbConfig::CONFIG["CC"]`
95
+ - `"gcc"`
96
+
97
+ You can pass it in like so:
98
+
99
+ ``` ruby
100
+ MiniPortile.new("libiconv", "1.13.1", gcc_command: "cc")
101
+ ```
102
+
103
+ #### `make_command`
104
+
105
+ The configuration/make command that is used is configurable, and in order of preference will use:
106
+
107
+ - the `MAKE` environment variable (if present)
108
+ - the `make_command` value passed in to the constructor
109
+ - the `make` environment variable (if present)
110
+ - `"make"`
111
+
112
+ You can pass it in like so:
113
+
114
+ ``` ruby
115
+ MiniPortile.new("libiconv", "1.13.1", make_command: "nmake")
116
+ ```
117
+
86
118
 
87
119
  ### How to use (for cmake projects)
88
120
 
89
121
  Same as above, but instead of `MiniPortile.new`, call `MiniPortileCMake.new`.
90
122
 
123
+ #### `make_command`
124
+
125
+ This is configurable as above, except for Windows systems where it's hardcoded to `"nmake"`.
126
+
127
+ #### `cmake_command`
128
+
129
+ The cmake command used is configurable, and in order of preference will use:
130
+
131
+ - the `CMAKE` environment variable (if present)
132
+ - the `cmake_command` value passed in to the constructor
133
+ - `"cmake"`
134
+
135
+ You can pass it in like so:
136
+
137
+ ``` ruby
138
+ MiniPortileCMake.new("libfoobar", "1.3.5", cmake_command: "cmake3")
139
+ ```
91
140
 
92
141
  ### Local source directories
93
142
 
@@ -46,7 +46,7 @@ class MiniPortile
46
46
  RbConfig::CONFIG['target_os'] =~ /mswin/
47
47
  end
48
48
 
49
- def initialize(name, version)
49
+ def initialize(name, version, **kwargs)
50
50
  @name = name
51
51
  @version = version
52
52
  @target = 'ports'
@@ -57,6 +57,9 @@ class MiniPortile
57
57
  @source_directory = nil
58
58
 
59
59
  @original_host = @host = detect_host
60
+
61
+ @gcc_command = kwargs[:gcc_command]
62
+ @make_command = kwargs[:make_command]
60
63
  end
61
64
 
62
65
  def source_directory=(path)
@@ -222,6 +225,14 @@ class MiniPortile
222
225
  File.expand_path(port_path)
223
226
  end
224
227
 
228
+ def gcc_cmd
229
+ (ENV["CC"] || @gcc_command || RbConfig::CONFIG["CC"] || "gcc").dup
230
+ end
231
+
232
+ def make_cmd
233
+ (ENV["MAKE"] || @make_command || ENV["make"] || "make").dup
234
+ end
235
+
225
236
  private
226
237
 
227
238
  def tmp_path
@@ -583,14 +594,4 @@ private
583
594
  FileUtils.mkdir_p File.dirname(full_path)
584
595
  FileUtils.mv temp_file.path, full_path, :force => true
585
596
  end
586
-
587
- def gcc_cmd
588
- cc = ENV["CC"] || RbConfig::CONFIG["CC"] || "gcc"
589
- return cc.dup
590
- end
591
-
592
- def make_cmd
593
- m = ENV['MAKE'] || ENV['make'] || 'make'
594
- return m.dup
595
- end
596
597
  end
@@ -5,6 +5,11 @@ class MiniPortileCMake < MiniPortile
5
5
  "-DCMAKE_INSTALL_PREFIX=#{File.expand_path(port_path)}"
6
6
  end
7
7
 
8
+ def initialize(name, version, **kwargs)
9
+ super(name, version, **kwargs)
10
+ @cmake_command = kwargs[:cmake_command]
11
+ end
12
+
8
13
  def configure_defaults
9
14
  if MiniPortile.mswin?
10
15
  ['-G', 'NMake Makefiles']
@@ -21,7 +26,7 @@ class MiniPortileCMake < MiniPortile
21
26
  cache_file = File.join(tmp_path, 'configure.options_cache')
22
27
  File.open(cache_file, "w") { |f| f.write computed_options.to_s }
23
28
 
24
- execute('configure', %w(cmake) + computed_options + ["."])
29
+ execute('configure', [cmake_cmd] + computed_options + ["."])
25
30
  end
26
31
 
27
32
  def configured?
@@ -39,4 +44,8 @@ class MiniPortileCMake < MiniPortile
39
44
  return "nmake" if MiniPortile.mswin?
40
45
  super
41
46
  end
47
+
48
+ def cmake_cmd
49
+ (ENV["CMAKE"] || @cmake_command || "cmake").dup
50
+ end
42
51
  end
@@ -1,3 +1,3 @@
1
1
  class MiniPortile
2
- VERSION = "2.6.1"
2
+ VERSION = "2.7.0"
3
3
  end
data/test/helper.rb CHANGED
@@ -57,4 +57,20 @@ class TestCase < Minitest::Test
57
57
  ensure
58
58
  ENV['GIT_DIR'] = old
59
59
  end
60
+
61
+ def with_env(env)
62
+ before = ENV.to_h.dup
63
+ env.each { |k, v| ENV[k] = v }
64
+ yield
65
+ ensure
66
+ ENV.replace(before)
67
+ end
68
+
69
+ def without_env(*keys, &blk)
70
+ before = ENV.to_h.dup
71
+ keys.flatten.each { |k| ENV.delete(k) }
72
+ yield
73
+ ensure
74
+ ENV.replace(before)
75
+ end
60
76
  end
data/test/test_cmake.rb CHANGED
@@ -58,3 +58,33 @@ class TestCMake < TestCase
58
58
  assert File.exist?(binary), binary
59
59
  end
60
60
  end
61
+
62
+ class TestCMakeConfig < TestCase
63
+ def test_make_command_configuration
64
+ MiniPortile.stub(:mswin?, false) do
65
+ without_env("MAKE") do
66
+ assert_equal("make", MiniPortileCMake.new("test", "1.0.0").make_cmd)
67
+ assert_equal("xyzzy", MiniPortileCMake.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
68
+ end
69
+ with_env("MAKE"=>"asdf") do
70
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0").make_cmd)
71
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
72
+ end
73
+ end
74
+
75
+ MiniPortile.stub(:mswin?, true) do
76
+ assert_equal("nmake", MiniPortileCMake.new("test", "1.0.0").make_cmd)
77
+ end
78
+ end
79
+
80
+ def test_cmake_command_configuration
81
+ without_env("CMAKE") do
82
+ assert_equal("cmake", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
83
+ assert_equal("xyzzy", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
84
+ end
85
+ with_env("CMAKE"=>"asdf") do
86
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
87
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
88
+ end
89
+ end
90
+ end
data/test/test_cook.rb CHANGED
@@ -67,6 +67,32 @@ class TestCook < TestCase
67
67
  end
68
68
  end
69
69
 
70
+ class TestCookConfiguration < TestCase
71
+ def test_make_command_configuration
72
+ without_env("MAKE") do
73
+ assert_equal("make", MiniPortile.new("test", "1.0.0").make_cmd)
74
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
75
+ end
76
+ with_env("MAKE"=>"asdf") do
77
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").make_cmd)
78
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
79
+ end
80
+ end
81
+
82
+ def test_gcc_command_configuration
83
+ without_env("CC") do
84
+ expected_compiler = RbConfig::CONFIG["CC"] || "gcc"
85
+ assert_equal(expected_compiler, MiniPortile.new("test", "1.0.0").gcc_cmd)
86
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
87
+ end
88
+ with_env("CC"=>"asdf") do
89
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").gcc_cmd)
90
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
91
+ end
92
+ end
93
+ end
94
+
95
+
70
96
  class TestCookWithBrokenGitDir < TestCase
71
97
  #
72
98
  # this is a test for #69
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.6.1
4
+ version: 2.7.0
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: 2021-05-31 00:00:00.000000000 Z
13
+ date: 2021-08-31 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.1.4
156
+ rubygems_version: 3.2.15
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Simplistic port-like solution for developers