mini_portile2 2.8.0 → 2.8.5
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 +22 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +44 -0
- data/README.md +15 -2
- data/lib/mini_portile2/mini_portile.rb +205 -28
- data/lib/mini_portile2/mini_portile_cmake.rb +100 -7
- data/lib/mini_portile2/version.rb +1 -1
- data/mini_portile2.gemspec +8 -7
- data/test/assets/pkgconf/libxml2/libxml-2.0.pc +13 -0
- data/test/assets/pkgconf/libxslt/libexslt.pc +13 -0
- data/test/assets/pkgconf/libxslt/libxslt.pc +13 -0
- data/test/test_activate.rb +139 -0
- data/test/test_cmake.rb +179 -8
- data/test/test_mkmf_config.rb +202 -0
- data/test/test_recipe.rb +18 -0
- metadata +22 -9
@@ -0,0 +1,13 @@
|
|
1
|
+
prefix=/foo/libxslt/1.1.38
|
2
|
+
exec_prefix=${prefix}
|
3
|
+
libdir=/foo/libxslt/1.1.38/lib
|
4
|
+
includedir=${prefix}/include
|
5
|
+
|
6
|
+
|
7
|
+
Name: libxslt
|
8
|
+
Version: 1.1.38
|
9
|
+
Description: XSLT library version 2.
|
10
|
+
Requires: libxml-2.0
|
11
|
+
Cflags: -I${includedir} -Wno-deprecated-enum-enum-conversion
|
12
|
+
Libs: -L${libdir} -lxslt
|
13
|
+
Libs.private: -lm
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
|
+
|
3
|
+
class TestActivate < TestCase
|
4
|
+
attr_reader :recipe
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
@save_env = %w[PATH CPATH LIBRARY_PATH LDFLAGS].inject({}) do |env, var|
|
10
|
+
env.update(var => ENV[var])
|
11
|
+
end
|
12
|
+
|
13
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
14
|
+
|
15
|
+
@recipe = MiniPortile.new("foo", "1.0.0").tap do |recipe|
|
16
|
+
recipe.logger = StringIO.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
22
|
+
|
23
|
+
@save_env.each do |var, val|
|
24
|
+
ENV[var] = val
|
25
|
+
end
|
26
|
+
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_PATH_env_var_when_bin_does_not_exist
|
31
|
+
ENV["PATH"] = "foo"
|
32
|
+
refute(Dir.exist?(bin_path))
|
33
|
+
refute_includes(path_elements('PATH'), bin_path)
|
34
|
+
|
35
|
+
recipe.activate
|
36
|
+
|
37
|
+
refute_includes(path_elements('PATH'), bin_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_PATH_env_var_when_bin_exists
|
41
|
+
ENV["PATH"] = "foo"
|
42
|
+
FileUtils.mkdir_p(bin_path)
|
43
|
+
refute_includes(path_elements('PATH'), bin_path)
|
44
|
+
|
45
|
+
recipe.activate
|
46
|
+
|
47
|
+
assert_includes(path_elements('PATH'), bin_path)
|
48
|
+
assert_equal(path_elements('PATH').first, bin_path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_CPATH_env_var_when_include_does_not_exist
|
52
|
+
ENV["CPATH"] = "foo"
|
53
|
+
refute(Dir.exist?(include_path))
|
54
|
+
refute_includes(path_elements('CPATH'), include_path)
|
55
|
+
|
56
|
+
recipe.activate
|
57
|
+
|
58
|
+
refute_includes(path_elements('CPATH'), include_path)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_CPATH_env_var_when_include_exists
|
62
|
+
ENV["CPATH"] = "foo"
|
63
|
+
FileUtils.mkdir_p(include_path)
|
64
|
+
refute_includes(path_elements('CPATH'), include_path)
|
65
|
+
|
66
|
+
recipe.activate
|
67
|
+
|
68
|
+
assert_includes(path_elements('CPATH'), include_path)
|
69
|
+
assert_equal(path_elements('CPATH').first, include_path)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_LIBRARY_PATH_env_var_when_lib_does_not_exist
|
73
|
+
ENV["LIBRARY_PATH"] = "foo"
|
74
|
+
refute(Dir.exist?(lib_path))
|
75
|
+
refute_includes(path_elements('LIBRARY_PATH'), lib_path)
|
76
|
+
|
77
|
+
recipe.activate
|
78
|
+
|
79
|
+
refute_includes(path_elements('LIBRARY_PATH'), lib_path)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_LIBRARY_PATH_env_var_when_lib_exists
|
83
|
+
ENV["LIBRARY_PATH"] = "foo"
|
84
|
+
FileUtils.mkdir_p(lib_path)
|
85
|
+
refute_includes(path_elements('LIBRARY_PATH'), lib_path)
|
86
|
+
|
87
|
+
recipe.activate
|
88
|
+
|
89
|
+
assert_includes(path_elements('LIBRARY_PATH'), lib_path)
|
90
|
+
assert_equal(path_elements('LIBRARY_PATH').first, lib_path)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_LDFLAGS_env_var_when_not_cross_compiling
|
94
|
+
ENV["LDFLAGS"] = "-lfoo"
|
95
|
+
FileUtils.mkdir_p(lib_path)
|
96
|
+
assert_equal(recipe.host, recipe.original_host) # assert on setup)
|
97
|
+
|
98
|
+
refute_includes(flag_elements('LDFLAGS'), "-L#{lib_path}")
|
99
|
+
|
100
|
+
recipe.activate
|
101
|
+
|
102
|
+
refute_includes(flag_elements('LDFLAGS'), "-L#{lib_path}")
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_LDFLAGS_env_var_when_cross_compiling
|
106
|
+
ENV["LDFLAGS"] = "-lfoo"
|
107
|
+
recipe.host = recipe.original_host + "-x" # make them not-equal
|
108
|
+
FileUtils.mkdir_p(lib_path)
|
109
|
+
|
110
|
+
refute_includes(flag_elements('LDFLAGS'), "-L#{lib_path}")
|
111
|
+
|
112
|
+
recipe.activate
|
113
|
+
|
114
|
+
assert_includes(flag_elements('LDFLAGS'), "-L#{lib_path}")
|
115
|
+
assert_equal(flag_elements('LDFLAGS').first, "-L#{lib_path}")
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def path_elements(varname)
|
121
|
+
ENV.fetch(varname, "").split(File::PATH_SEPARATOR)
|
122
|
+
end
|
123
|
+
|
124
|
+
def flag_elements(varname)
|
125
|
+
ENV.fetch(varname, "").split
|
126
|
+
end
|
127
|
+
|
128
|
+
def bin_path
|
129
|
+
MiniPortile.native_path(File.join(recipe.path, "bin"))
|
130
|
+
end
|
131
|
+
|
132
|
+
def include_path
|
133
|
+
MiniPortile.native_path(File.join(recipe.path, "include"))
|
134
|
+
end
|
135
|
+
|
136
|
+
def lib_path
|
137
|
+
MiniPortile.native_path(File.join(recipe.path, "lib"))
|
138
|
+
end
|
139
|
+
end
|
data/test/test_cmake.rb
CHANGED
@@ -14,13 +14,11 @@ class TestCMake < TestCase
|
|
14
14
|
create_tar(@tar_path, @assets_path, "test-cmake-1.0")
|
15
15
|
start_webrick(File.dirname(@tar_path))
|
16
16
|
|
17
|
-
@recipe =
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
recipe.cook
|
23
|
-
end
|
17
|
+
@recipe = init_recipe
|
18
|
+
|
19
|
+
git_dir = File.join(@assets_path, "git")
|
20
|
+
with_custom_git_dir(git_dir) do
|
21
|
+
recipe.cook
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
@@ -57,9 +55,16 @@ class TestCMake < TestCase
|
|
57
55
|
binary = File.join(recipe.path, "bin", exe_name)
|
58
56
|
assert File.exist?(binary), binary
|
59
57
|
end
|
58
|
+
|
59
|
+
def init_recipe
|
60
|
+
MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe|
|
61
|
+
recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
|
62
|
+
recipe.patch_files << File.join(@assets_path, "patch 1.diff")
|
63
|
+
end
|
64
|
+
end
|
60
65
|
end
|
61
66
|
|
62
|
-
class TestCMakeConfig <
|
67
|
+
class TestCMakeConfig < TestCMake
|
63
68
|
def test_make_command_configuration
|
64
69
|
MiniPortile.stub(:mswin?, false) do
|
65
70
|
without_env("MAKE") do
|
@@ -77,6 +82,109 @@ class TestCMakeConfig < TestCase
|
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
85
|
+
def test_configure_defaults_with_macos
|
86
|
+
recipe = init_recipe
|
87
|
+
recipe.host = 'some-host'
|
88
|
+
|
89
|
+
with_env({ "CC" => nil, "CXX" => nil }) do
|
90
|
+
MiniPortile.stub(:darwin?, true) do
|
91
|
+
with_stubbed_target(os: 'darwin22', cpu: 'arm64') do
|
92
|
+
with_compilers(recipe, host_prefix: true, c_compiler: 'clang', cxx_compiler: 'clang++') do
|
93
|
+
Open3.stub(:capture2, cmake_help_mock('Unix')) do
|
94
|
+
assert_equal(
|
95
|
+
[
|
96
|
+
"-DCMAKE_SYSTEM_NAME=Darwin",
|
97
|
+
"-DCMAKE_SYSTEM_PROCESSOR=arm64",
|
98
|
+
"-DCMAKE_C_COMPILER=some-host-clang",
|
99
|
+
"-DCMAKE_CXX_COMPILER=some-host-clang++",
|
100
|
+
"-DCMAKE_BUILD_TYPE=Release"
|
101
|
+
],
|
102
|
+
recipe.configure_defaults)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_configure_defaults_with_manual_system_name
|
111
|
+
recipe = init_recipe
|
112
|
+
recipe.system_name = 'Custom'
|
113
|
+
|
114
|
+
MiniPortile.stub(:darwin?, false) do
|
115
|
+
with_stubbed_target do
|
116
|
+
with_compilers(recipe) do
|
117
|
+
Open3.stub(:capture2, cmake_help_mock('Unix')) do
|
118
|
+
assert_equal(
|
119
|
+
[
|
120
|
+
"-DCMAKE_SYSTEM_NAME=Custom",
|
121
|
+
"-DCMAKE_SYSTEM_PROCESSOR=x86_64",
|
122
|
+
"-DCMAKE_C_COMPILER=gcc",
|
123
|
+
"-DCMAKE_CXX_COMPILER=g++",
|
124
|
+
"-DCMAKE_BUILD_TYPE=Release"
|
125
|
+
],
|
126
|
+
recipe.configure_defaults)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_configure_defaults_with_unix_makefiles
|
134
|
+
recipe = init_recipe
|
135
|
+
|
136
|
+
MiniPortile.stub(:linux?, true) do
|
137
|
+
MiniPortile.stub(:darwin?, false) do
|
138
|
+
with_stubbed_target do
|
139
|
+
with_compilers(recipe) do
|
140
|
+
Open3.stub(:capture2, cmake_help_mock('Unix')) do
|
141
|
+
MiniPortile.stub(:mingw?, true) do
|
142
|
+
assert_equal(default_x86_compile_flags,
|
143
|
+
recipe.configure_defaults)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_configure_defaults_with_msys_makefiles
|
153
|
+
recipe = init_recipe
|
154
|
+
|
155
|
+
MiniPortile.stub(:linux?, true) do
|
156
|
+
MiniPortile.stub(:darwin?, false) do
|
157
|
+
with_stubbed_target do
|
158
|
+
with_compilers(recipe) do
|
159
|
+
Open3.stub(:capture2, cmake_help_mock('MSYS')) do
|
160
|
+
MiniPortile.stub(:mingw?, true) do
|
161
|
+
assert_equal(['-G', 'MSYS Makefiles'] + default_x86_compile_flags, recipe.configure_defaults)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_configure_defaults_with_nmake_makefiles
|
171
|
+
recipe = init_recipe
|
172
|
+
|
173
|
+
MiniPortile.stub(:linux?, true) do
|
174
|
+
MiniPortile.stub(:darwin?, false) do
|
175
|
+
with_stubbed_target do
|
176
|
+
with_compilers(recipe) do
|
177
|
+
Open3.stub(:capture2, cmake_help_mock('NMake')) do
|
178
|
+
MiniPortile.stub(:mswin?, true) do
|
179
|
+
assert_equal(['-G', 'NMake Makefiles'] + default_x86_compile_flags, recipe.configure_defaults)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
80
188
|
def test_cmake_command_configuration
|
81
189
|
without_env("CMAKE") do
|
82
190
|
assert_equal("cmake", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
|
@@ -87,4 +195,67 @@ class TestCMakeConfig < TestCase
|
|
87
195
|
assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
|
88
196
|
end
|
89
197
|
end
|
198
|
+
|
199
|
+
def test_cmake_build_type_configuration
|
200
|
+
without_env("CMAKE_BUILD_TYPE") do
|
201
|
+
assert_equal("Release", MiniPortileCMake.new("test", "1.0.0").cmake_build_type)
|
202
|
+
assert_equal("xyzzy", MiniPortileCMake.new("test", "1.0.0", cmake_build_type: "xyzzy").cmake_build_type)
|
203
|
+
end
|
204
|
+
with_env("CMAKE_BUILD_TYPE"=>"Debug") do
|
205
|
+
assert_equal("Debug", MiniPortileCMake.new("test", "1.0.0").cmake_build_type)
|
206
|
+
assert_equal("Debug", MiniPortileCMake.new("test", "1.0.0", cmake_build_type: "xyzzy").cmake_build_type)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
private
|
211
|
+
|
212
|
+
def with_stubbed_target(os: 'linux', cpu: 'x86_64')
|
213
|
+
MiniPortile.stub(:target_os, os) do
|
214
|
+
MiniPortile.stub(:target_cpu, cpu) do
|
215
|
+
yield
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def with_compilers(recipe, host_prefix: false, c_compiler: 'gcc', cxx_compiler: 'g++')
|
221
|
+
mock = MiniTest::Mock.new
|
222
|
+
|
223
|
+
if host_prefix
|
224
|
+
mock.expect(:call, true, ["#{recipe.host}-#{c_compiler}"])
|
225
|
+
mock.expect(:call, true, ["#{recipe.host}-#{cxx_compiler}"])
|
226
|
+
else
|
227
|
+
mock.expect(:call, false, ["#{recipe.host}-#{c_compiler}"])
|
228
|
+
mock.expect(:call, true, [c_compiler])
|
229
|
+
mock.expect(:call, false, ["#{recipe.host}-#{cxx_compiler}"])
|
230
|
+
mock.expect(:call, true, [cxx_compiler])
|
231
|
+
end
|
232
|
+
|
233
|
+
recipe.stub(:which, mock) do
|
234
|
+
yield
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def default_x86_compile_flags
|
239
|
+
[
|
240
|
+
"-DCMAKE_SYSTEM_NAME=Linux",
|
241
|
+
"-DCMAKE_SYSTEM_PROCESSOR=x86_64",
|
242
|
+
"-DCMAKE_C_COMPILER=gcc",
|
243
|
+
"-DCMAKE_CXX_COMPILER=g++",
|
244
|
+
"-DCMAKE_BUILD_TYPE=Release"
|
245
|
+
]
|
246
|
+
end
|
247
|
+
|
248
|
+
def cmake_help_mock(generator_type)
|
249
|
+
open3_mock = MiniTest::Mock.new
|
250
|
+
cmake_script = <<~SCRIPT
|
251
|
+
echo "The following generators are available on this platform (* marks default):"
|
252
|
+
echo "* #{generator_type} Makefiles = Generates standard #{generator_type.upcase} makefiles."
|
253
|
+
SCRIPT
|
254
|
+
|
255
|
+
exit_status = MiniTest::Mock.new
|
256
|
+
exit_status.expect(:success?, true)
|
257
|
+
expected_output = [cmake_script, exit_status]
|
258
|
+
open3_mock.expect(:call, expected_output, ['cmake --help'])
|
259
|
+
open3_mock
|
260
|
+
end
|
90
261
|
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
|
+
|
3
|
+
require "mkmf" # initialize $LDFLAGS et al here, instead of in the middle of a test
|
4
|
+
|
5
|
+
class TestMkmfConfig < TestCase
|
6
|
+
attr_reader :recipe
|
7
|
+
|
8
|
+
LIBXML_PCP = File.join(__dir__, "assets", "pkgconf", "libxml2")
|
9
|
+
LIBXSLT_PCP = File.join(__dir__, "assets", "pkgconf", "libxslt")
|
10
|
+
|
11
|
+
def make_recipe(name, version)
|
12
|
+
MiniPortile.new(name, version).tap do |recipe|
|
13
|
+
recipe.logger = StringIO.new # hush output
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
|
20
|
+
@save_env = %w[PATH CPATH LIBRARY_PATH LDFLAGS PKG_CONFIG_PATH].inject({}) do |env, var|
|
21
|
+
env.update(var => ENV[var])
|
22
|
+
end
|
23
|
+
$INCFLAGS = "-I/xxx"
|
24
|
+
$LIBPATH = ["xxx"]
|
25
|
+
$CFLAGS = "-xxx"
|
26
|
+
$CXXFLAGS = "-xxx"
|
27
|
+
$libs = "-lxxx"
|
28
|
+
$MINI_PORTILE_STATIC_LIBS = {}
|
29
|
+
|
30
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
31
|
+
|
32
|
+
@recipe = make_recipe("libfoo", "1.0.0")
|
33
|
+
end
|
34
|
+
|
35
|
+
def teardown
|
36
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
37
|
+
|
38
|
+
$INCFLAGS = ""
|
39
|
+
$LIBPATH = []
|
40
|
+
$CFLAGS = ""
|
41
|
+
$CXXFLAGS = ""
|
42
|
+
$libs = ""
|
43
|
+
$MINI_PORTILE_STATIC_LIBS = {}
|
44
|
+
@save_env.each do |var, val|
|
45
|
+
ENV[var] = val
|
46
|
+
end
|
47
|
+
|
48
|
+
super
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_mkmf_config_recipe_LIBPATH_global_lib_dir_does_not_exist
|
52
|
+
recipe.mkmf_config
|
53
|
+
|
54
|
+
refute_includes($LIBPATH, recipe.lib_path)
|
55
|
+
refute_includes($libs.shellsplit, "-lfoo")
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_mkmf_config_recipe_LIBPATH_global_not_static
|
59
|
+
FileUtils.mkdir_p(recipe.lib_path)
|
60
|
+
|
61
|
+
recipe.mkmf_config
|
62
|
+
|
63
|
+
assert_includes($LIBPATH, recipe.lib_path)
|
64
|
+
assert_operator($LIBPATH.index(recipe.lib_path), :<, $LIBPATH.index("xxx")) # prepend
|
65
|
+
|
66
|
+
assert_includes($libs.shellsplit, "-lfoo") # note the recipe name is "libfoo"
|
67
|
+
assert_match(%r{-lfoo.*-lxxx}, $libs) # prepend
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_mkmf_config_recipe_LIBPATH_global_static
|
71
|
+
FileUtils.mkdir_p(recipe.lib_path)
|
72
|
+
static_lib_path = File.join(recipe.lib_path, "libfoo.#{$LIBEXT}")
|
73
|
+
|
74
|
+
recipe.mkmf_config(static: "foo")
|
75
|
+
|
76
|
+
refute_includes($LIBPATH, recipe.lib_path)
|
77
|
+
|
78
|
+
refute_includes($libs.shellsplit, "-lfoo") # note the recipe name is "libfoo"
|
79
|
+
assert_includes($libs.shellsplit, static_lib_path)
|
80
|
+
assert_match(%r{#{static_lib_path}.*-lxxx}, $libs) # prepend
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_mkmf_config_recipe_INCFLAGS_global_include_dir_does_not_exist
|
84
|
+
recipe.mkmf_config
|
85
|
+
|
86
|
+
refute_includes($INCFLAGS.shellsplit, "-I#{recipe.include_path}")
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_mkmf_config_recipe_INCFLAGS_global
|
90
|
+
FileUtils.mkdir_p(recipe.include_path)
|
91
|
+
|
92
|
+
recipe.mkmf_config
|
93
|
+
|
94
|
+
assert_includes($INCFLAGS.shellsplit, "-I#{recipe.include_path}")
|
95
|
+
assert_match(%r{-I#{recipe.include_path}.*-I/xxx}, $INCFLAGS) # prepend
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_mkmf_config_pkgconf_does_not_exist
|
99
|
+
assert_raises(ArgumentError) do
|
100
|
+
recipe.mkmf_config(pkg: "foo")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_mkmf_config_pkgconf_LIBPATH_global_not_static
|
105
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
106
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
107
|
+
|
108
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
|
109
|
+
|
110
|
+
assert_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
|
111
|
+
assert_operator($LIBPATH.index("/foo/libxml2/2.11.5/lib"), :<, $LIBPATH.index("xxx")) # prepend
|
112
|
+
refute_includes($LIBPATH, "/foo/zlib/1.3/lib")
|
113
|
+
|
114
|
+
assert_includes($libs.shellsplit, "-lxml2")
|
115
|
+
assert_match(%r{-lxml2.*-lxxx}, $libs) # prepend
|
116
|
+
refute_includes($libs.shellsplit, "-lz")
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_mkmf_config_pkgconf_LIBPATH_global_static
|
120
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
121
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
122
|
+
|
123
|
+
static_lib_path = "/foo/libxml2/2.11.5/lib/libxml2.#{$LIBEXT}"
|
124
|
+
|
125
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP, static: "xml2")
|
126
|
+
|
127
|
+
refute_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
|
128
|
+
refute_includes($libs.shellsplit, "-lxml2")
|
129
|
+
assert_includes($libs.shellsplit, static_lib_path)
|
130
|
+
assert_match(%r{#{static_lib_path}.*-lxxx}, $libs) # prepend
|
131
|
+
|
132
|
+
assert_includes($LIBPATH, "/foo/zlib/1.3/lib") # from --static
|
133
|
+
assert_includes($libs.shellsplit, "-lz") # from --static
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_mkmf_config_pkgconf_CFLAGS_global
|
137
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
138
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
139
|
+
|
140
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
|
141
|
+
|
142
|
+
assert_includes($INCFLAGS.shellsplit, "-I/foo/libxml2/2.11.5/include/libxml2")
|
143
|
+
assert_match(%r{-I/foo/libxml2/2.11.5/include/libxml2.*-I/xxx}, $INCFLAGS) # prepend
|
144
|
+
|
145
|
+
assert_includes($CFLAGS.shellsplit, "-ggdb3")
|
146
|
+
assert_match(%r{-xxx.*-ggdb3}, $CFLAGS) # append
|
147
|
+
|
148
|
+
assert_includes($CXXFLAGS.shellsplit, "-ggdb3")
|
149
|
+
assert_match(%r{-xxx.*-ggdb3}, $CXXFLAGS) # append
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_mkmf_config_pkgconf_path_accumulation
|
153
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
154
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
155
|
+
|
156
|
+
(ENV["PKG_CONFIG_PATH"] || "").split(File::PATH_SEPARATOR).tap do |pcpaths|
|
157
|
+
refute_includes(pcpaths, LIBXML_PCP)
|
158
|
+
refute_includes(pcpaths, LIBXSLT_PCP)
|
159
|
+
end
|
160
|
+
|
161
|
+
make_recipe("libxml2", "2.11.5").tap do |recipe|
|
162
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP, static: "xml2")
|
163
|
+
|
164
|
+
ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
|
165
|
+
assert_includes(pcpaths, LIBXML_PCP)
|
166
|
+
refute_includes(pcpaths, LIBXSLT_PCP)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
make_recipe("libxslt", "1.13.8").tap do |recipe|
|
171
|
+
recipe.mkmf_config(pkg: "libxslt", dir: LIBXSLT_PCP, static: "xslt")
|
172
|
+
|
173
|
+
ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
|
174
|
+
assert_includes(pcpaths, LIBXML_PCP)
|
175
|
+
assert_includes(pcpaths, LIBXSLT_PCP)
|
176
|
+
end
|
177
|
+
|
178
|
+
recipe.mkmf_config(pkg: "libexslt", dir: LIBXSLT_PCP, static: "exslt")
|
179
|
+
end
|
180
|
+
|
181
|
+
$INCFLAGS.shellsplit.tap do |incflags|
|
182
|
+
assert_includes(incflags, "-I/foo/libxml2/2.11.5/include/libxml2")
|
183
|
+
assert_includes(incflags, "-I/foo/libxslt/1.1.38/include")
|
184
|
+
end
|
185
|
+
$CFLAGS.shellsplit.tap do |cflags|
|
186
|
+
assert_includes(cflags, "-ggdb3")
|
187
|
+
assert_includes(cflags, "-Wno-deprecated-enum-enum-conversion")
|
188
|
+
end
|
189
|
+
refute_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
|
190
|
+
refute_includes($LIBPATH, "/foo/libxslt/1.1.38/lib")
|
191
|
+
assert_includes($LIBPATH, "/foo/zlib/1.3/lib") # from `--static`
|
192
|
+
$libs.shellsplit.tap do |libflags|
|
193
|
+
refute_includes(libflags, "-lxml2")
|
194
|
+
assert_includes(libflags, "/foo/libxml2/2.11.5/lib/libxml2.#{$LIBEXT}")
|
195
|
+
refute_includes(libflags, "-lxslt")
|
196
|
+
assert_includes(libflags, "/foo/libxslt/1.1.38/lib/libxslt.#{$LIBEXT}")
|
197
|
+
refute_includes(libflags, "-lexslt")
|
198
|
+
assert_includes(libflags, "/foo/libxslt/1.1.38/lib/libexslt.#{$LIBEXT}")
|
199
|
+
assert_includes(libflags, "-lz") # from `--static`
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
data/test/test_recipe.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
|
+
|
3
|
+
class TestRecipe < TestCase
|
4
|
+
def test_path
|
5
|
+
recipe = MiniPortile.new("libfoo", "1.0.0")
|
6
|
+
assert_equal(File.expand_path(File.join(recipe.target, recipe.host, recipe.name, recipe.version)), recipe.path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_lib_path
|
10
|
+
recipe = MiniPortile.new("libfoo", "1.0.0")
|
11
|
+
assert_equal(File.join(recipe.path, "lib"), recipe.lib_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_include_path
|
15
|
+
recipe = MiniPortile.new("libfoo", "1.0.0")
|
16
|
+
assert_equal(File.join(recipe.path, "include"), recipe.include_path)
|
17
|
+
end
|
18
|
+
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.5
|
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-10-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2.
|
21
|
+
version: '2.2'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '2.
|
28
|
+
version: '2.2'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: minitar
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,9 +96,10 @@ dependencies:
|
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '1.7'
|
99
|
-
description:
|
100
|
-
and
|
101
|
-
system.
|
99
|
+
description: |
|
100
|
+
Simple autoconf and cmake builder for developers. It provides a standard way to compile against
|
101
|
+
dependency libraries without requiring system-wide installation. It also simplifies
|
102
|
+
vendoring and cross-compilation by providing a consistent build interface.
|
102
103
|
email: mike.dalessio@gmail.com
|
103
104
|
executables: []
|
104
105
|
extensions: []
|
@@ -123,17 +124,23 @@ files:
|
|
123
124
|
- test/assets/gpg-fixtures/data.asc
|
124
125
|
- test/assets/gpg-fixtures/data.invalid.asc
|
125
126
|
- test/assets/patch 1.diff
|
127
|
+
- test/assets/pkgconf/libxml2/libxml-2.0.pc
|
128
|
+
- test/assets/pkgconf/libxslt/libexslt.pc
|
129
|
+
- test/assets/pkgconf/libxslt/libxslt.pc
|
126
130
|
- test/assets/test mini portile-1.0.0/configure
|
127
131
|
- test/assets/test-cmake-1.0/CMakeLists.txt
|
128
132
|
- test/assets/test-cmake-1.0/hello.c
|
129
133
|
- test/assets/test-download-archive.tar.gz
|
130
134
|
- test/helper.rb
|
135
|
+
- test/test_activate.rb
|
131
136
|
- test/test_cmake.rb
|
132
137
|
- test/test_cook.rb
|
133
138
|
- test/test_digest.rb
|
134
139
|
- test/test_download.rb
|
135
140
|
- test/test_execute.rb
|
141
|
+
- test/test_mkmf_config.rb
|
136
142
|
- test/test_proxy.rb
|
143
|
+
- test/test_recipe.rb
|
137
144
|
homepage: https://github.com/flavorjones/mini_portile
|
138
145
|
licenses:
|
139
146
|
- MIT
|
@@ -153,24 +160,30 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
160
|
- !ruby/object:Gem::Version
|
154
161
|
version: '0'
|
155
162
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.4.19
|
157
164
|
signing_key:
|
158
165
|
specification_version: 4
|
159
|
-
summary:
|
166
|
+
summary: Simple autoconf and cmake builder for developers
|
160
167
|
test_files:
|
161
168
|
- test/assets/git/config
|
162
169
|
- test/assets/gpg-fixtures/data
|
163
170
|
- test/assets/gpg-fixtures/data.asc
|
164
171
|
- test/assets/gpg-fixtures/data.invalid.asc
|
165
172
|
- test/assets/patch 1.diff
|
173
|
+
- test/assets/pkgconf/libxml2/libxml-2.0.pc
|
174
|
+
- test/assets/pkgconf/libxslt/libexslt.pc
|
175
|
+
- test/assets/pkgconf/libxslt/libxslt.pc
|
166
176
|
- test/assets/test mini portile-1.0.0/configure
|
167
177
|
- test/assets/test-cmake-1.0/CMakeLists.txt
|
168
178
|
- test/assets/test-cmake-1.0/hello.c
|
169
179
|
- test/assets/test-download-archive.tar.gz
|
170
180
|
- test/helper.rb
|
181
|
+
- test/test_activate.rb
|
171
182
|
- test/test_cmake.rb
|
172
183
|
- test/test_cook.rb
|
173
184
|
- test/test_digest.rb
|
174
185
|
- test/test_download.rb
|
175
186
|
- test/test_execute.rb
|
187
|
+
- test/test_mkmf_config.rb
|
176
188
|
- test/test_proxy.rb
|
189
|
+
- test/test_recipe.rb
|