mini_portile2 2.8.4 → 2.8.5.rc1
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 +4 -4
- data/.github/workflows/ci.yml +18 -1
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/lib/mini_portile2/mini_portile.rb +100 -15
- data/lib/mini_portile2/version.rb +1 -1
- 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_mkmf_config.rb +159 -0
- metadata +15 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 235fc41ae2e4aab6133eb8edb741bb535194af46c1aca4e70f0785d2c1253322
|
|
4
|
+
data.tar.gz: 4ffdc351e59c3cec669361e0fb7b50b536d113363a7ed1c91d8fb681453df4fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03deed0dd932686706f7956fda4f167fb46c73f87f443c058163226019de21d16252c509b453fccfaa8b661bf3f9667b0c1f2fec66edcef042a968fcd847811f
|
|
7
|
+
data.tar.gz: a5d574f3b181ed8303ae0c799e6092fde2166fd1dc5937961f7b8016eef441a287cf80c4abf1bb2ec0f036894a12ea80f12edb30cec631981f6d8f042ad87959
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -67,5 +67,22 @@ jobs:
|
|
|
67
67
|
- uses: actions/cache@v3
|
|
68
68
|
with:
|
|
69
69
|
path: examples/ports/archives
|
|
70
|
-
key:
|
|
70
|
+
key: examples-${{ hashFiles('examples/Rakefile') }}
|
|
71
|
+
- run: bundle exec rake test:examples
|
|
72
|
+
|
|
73
|
+
fedora: # see https://github.com/flavorjones/mini_portile/issues/118
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
container:
|
|
76
|
+
image: fedora:35
|
|
77
|
+
steps:
|
|
78
|
+
- run: |
|
|
79
|
+
dnf group install -y "C Development Tools and Libraries"
|
|
80
|
+
dnf install -y ruby ruby-devel libyaml-devel git-all patch cmake xz
|
|
81
|
+
- uses: actions/checkout@v3
|
|
82
|
+
- uses: actions/cache@v3
|
|
83
|
+
with:
|
|
84
|
+
path: examples/ports/archives
|
|
85
|
+
key: examples-${{ hashFiles('examples/Rakefile') }}
|
|
86
|
+
- run: bundle install
|
|
87
|
+
- run: bundle exec rake test:unit
|
|
71
88
|
- run: bundle exec rake test:examples
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
## mini_portile changelog
|
|
2
2
|
|
|
3
|
+
### 2.8.5.rc1 / 2023-09-13
|
|
4
|
+
|
|
5
|
+
#### Added
|
|
6
|
+
|
|
7
|
+
- New method `MiniPortile#mkmf_config` will set up MakeMakefile variables to properly link against the recipe. This should make it easier for C extensions to package third-party libraries.
|
|
8
|
+
- With no arguments, will set up just `$INCFLAGS`, `$libs`, and `$LIBPATH`.
|
|
9
|
+
- Optionally, if provided a pkg-config file, will use that config to more precisely set `$INCFLAGS`, `$libs`, `$LIBPATH`, and `$CFLAGS`/`$CXXFLAGS`.
|
|
10
|
+
|
|
11
|
+
|
|
3
12
|
### 2.8.4 / 2023-07-18
|
|
4
13
|
|
|
5
14
|
- cmake: set CMAKE compile flags to configure cross-compilation similarly to `autotools` `--host` flag: `SYSTEM_NAME`, `SYSTEM_PROCESSOR`, `C_COMPILER`, and `CXX_COMPILER`. [#130] (Thanks, @stanhu!)
|
|
@@ -76,6 +76,24 @@ class MiniPortile
|
|
|
76
76
|
RbConfig::CONFIG['target_cpu']
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
+
def self.native_path(path)
|
|
80
|
+
path = File.expand_path(path)
|
|
81
|
+
if File::ALT_SEPARATOR
|
|
82
|
+
path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
|
83
|
+
else
|
|
84
|
+
path
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.posix_path(path)
|
|
89
|
+
path = File.expand_path(path)
|
|
90
|
+
if File::ALT_SEPARATOR
|
|
91
|
+
"/" + path.tr(File::ALT_SEPARATOR, File::SEPARATOR).tr(":", File::SEPARATOR)
|
|
92
|
+
else
|
|
93
|
+
path
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
79
97
|
def initialize(name, version, **kwargs)
|
|
80
98
|
@name = name
|
|
81
99
|
@version = version
|
|
@@ -86,12 +104,12 @@ class MiniPortile
|
|
|
86
104
|
@logger = STDOUT
|
|
87
105
|
@source_directory = nil
|
|
88
106
|
|
|
89
|
-
@original_host = @host = detect_host
|
|
90
|
-
|
|
91
107
|
@gcc_command = kwargs[:gcc_command]
|
|
92
108
|
@make_command = kwargs[:make_command]
|
|
93
109
|
@open_timeout = kwargs[:open_timeout] || DEFAULT_TIMEOUT
|
|
94
110
|
@read_timeout = kwargs[:read_timeout] || DEFAULT_TIMEOUT
|
|
111
|
+
|
|
112
|
+
@original_host = @host = detect_host
|
|
95
113
|
end
|
|
96
114
|
|
|
97
115
|
def source_directory=(path)
|
|
@@ -240,7 +258,7 @@ class MiniPortile
|
|
|
240
258
|
|
|
241
259
|
# rely on LDFLAGS when cross-compiling
|
|
242
260
|
if File.exist?(lib_path) && (@host != @original_host)
|
|
243
|
-
full_path =
|
|
261
|
+
full_path = native_path(lib_path)
|
|
244
262
|
|
|
245
263
|
old_value = ENV.fetch("LDFLAGS", "")
|
|
246
264
|
|
|
@@ -250,6 +268,58 @@ class MiniPortile
|
|
|
250
268
|
end
|
|
251
269
|
end
|
|
252
270
|
|
|
271
|
+
def mkmf_config(pkg: nil, dir: nil)
|
|
272
|
+
require "mkmf"
|
|
273
|
+
|
|
274
|
+
if pkg
|
|
275
|
+
dir ||= File.join(path, "lib", "pkgconfig")
|
|
276
|
+
pcfile = File.join(dir, "#{pkg}.pc")
|
|
277
|
+
unless File.exist?(pcfile)
|
|
278
|
+
raise ArgumentError, "pkg-config file '#{pcfile}' does not exist"
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
output "Configuring MakeMakefile for #{File.basename(pcfile)} (in #{File.dirname(pcfile)})\n"
|
|
282
|
+
|
|
283
|
+
# on macos, pkg-config will not return --cflags without this
|
|
284
|
+
ENV["PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"] = "t"
|
|
285
|
+
|
|
286
|
+
# append to PKG_CONFIG_PATH as we go, so later pkg-config files can depend on earlier ones
|
|
287
|
+
ENV["PKG_CONFIG_PATH"] = [ENV["PKG_CONFIG_PATH"], dir].compact.join(File::PATH_SEPARATOR)
|
|
288
|
+
|
|
289
|
+
incflags = minimal_pkg_config(pcfile, "cflags-only-I")
|
|
290
|
+
cflags = minimal_pkg_config(pcfile, "cflags-only-other")
|
|
291
|
+
ldflags = minimal_pkg_config(pcfile, "libs-only-L", "static")
|
|
292
|
+
libflags = minimal_pkg_config(pcfile, "libs-only-l", "static")
|
|
293
|
+
else
|
|
294
|
+
output "Configuring MakeMakefile for #{@name} #{@version} (from #{path})\n"
|
|
295
|
+
|
|
296
|
+
include_path = File.join(path, "include")
|
|
297
|
+
lib_path = File.join(path, "lib")
|
|
298
|
+
|
|
299
|
+
lib_name = name.sub(/\Alib/, "") # TODO: use delete_prefix when we no longer support ruby 2.4
|
|
300
|
+
|
|
301
|
+
incflags = "-I#{include_path}" if Dir.exist?(include_path)
|
|
302
|
+
ldflags = "-L#{lib_path}" if Dir.exist?(lib_path)
|
|
303
|
+
libflags = "-l#{lib_name}" if Dir.exist?(lib_path)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
if ldflags
|
|
307
|
+
libpaths = ldflags.split.map { |f| f.sub(/\A-L/, "") }
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# prefer this package by prepending directories to the search path
|
|
311
|
+
#
|
|
312
|
+
# use $LIBPATH instead of $LDFLAGS to ensure we get the `-Wl,-rpath` linker flag for re-finding
|
|
313
|
+
# shared libraries
|
|
314
|
+
$INCFLAGS = [incflags, $INCFLAGS].join(" ").strip if incflags
|
|
315
|
+
$LIBPATH = libpaths | $LIBPATH if libpaths
|
|
316
|
+
|
|
317
|
+
# prefer this package's flags by appending them to the command line
|
|
318
|
+
$CFLAGS = [$CFLAGS, cflags].join(" ").strip if cflags
|
|
319
|
+
$CXXFLAGS = [$CXXFLAGS, cflags].join(" ").strip if cflags
|
|
320
|
+
$libs = [$libs, libflags].join(" ").strip if libflags
|
|
321
|
+
end
|
|
322
|
+
|
|
253
323
|
def path
|
|
254
324
|
File.expand_path(port_path)
|
|
255
325
|
end
|
|
@@ -265,21 +335,11 @@ class MiniPortile
|
|
|
265
335
|
private
|
|
266
336
|
|
|
267
337
|
def native_path(path)
|
|
268
|
-
|
|
269
|
-
if File::ALT_SEPARATOR
|
|
270
|
-
path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
|
271
|
-
else
|
|
272
|
-
path
|
|
273
|
-
end
|
|
338
|
+
MiniPortile.native_path(path)
|
|
274
339
|
end
|
|
275
340
|
|
|
276
341
|
def posix_path(path)
|
|
277
|
-
|
|
278
|
-
if File::ALT_SEPARATOR
|
|
279
|
-
"/" + path.tr(File::ALT_SEPARATOR, File::SEPARATOR).tr(":", File::SEPARATOR)
|
|
280
|
-
else
|
|
281
|
-
path
|
|
282
|
-
end
|
|
342
|
+
MiniPortile.posix_path(path)
|
|
283
343
|
end
|
|
284
344
|
|
|
285
345
|
def tmp_path
|
|
@@ -648,4 +708,29 @@ class MiniPortile
|
|
|
648
708
|
FileUtils.mkdir_p File.dirname(full_path)
|
|
649
709
|
FileUtils.mv temp_file.path, full_path, :force => true
|
|
650
710
|
end
|
|
711
|
+
|
|
712
|
+
#
|
|
713
|
+
# this minimal version of pkg_config is based on ruby 29dc9378 (2023-01-09)
|
|
714
|
+
#
|
|
715
|
+
# specifically with the fix from b90e56e6 to support multiple pkg-config options, and removing
|
|
716
|
+
# code paths that aren't helpful for mini-portile's use case of parsing pc files.
|
|
717
|
+
#
|
|
718
|
+
def minimal_pkg_config(pkg, *pcoptions)
|
|
719
|
+
if pcoptions.empty?
|
|
720
|
+
raise ArgumentError, "no pkg-config options are given"
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
if ($PKGCONFIG ||=
|
|
724
|
+
(pkgconfig = MakeMakefile.with_config("pkg-config") {MakeMakefile.config_string("PKG_CONFIG") || "pkg-config"}) &&
|
|
725
|
+
MakeMakefile.find_executable0(pkgconfig) && pkgconfig)
|
|
726
|
+
pkgconfig = $PKGCONFIG
|
|
727
|
+
else
|
|
728
|
+
raise RuntimeError, "pkg-config is not found"
|
|
729
|
+
end
|
|
730
|
+
|
|
731
|
+
pcoptions = Array(pcoptions).map { |o| "--#{o}" }
|
|
732
|
+
response = IO.popen([pkgconfig, *pcoptions, pkg], err:[:child, :out], &:read)
|
|
733
|
+
raise RuntimeError, response unless $?.success?
|
|
734
|
+
response.strip
|
|
735
|
+
end
|
|
651
736
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
prefix=/foo/libxml2/2.11.5
|
|
2
|
+
exec_prefix=${prefix}
|
|
3
|
+
libdir=/foo/libxml2/2.11.5/lib
|
|
4
|
+
includedir=${prefix}/include
|
|
5
|
+
modules=1
|
|
6
|
+
|
|
7
|
+
Name: libXML
|
|
8
|
+
Version: 2.11.5
|
|
9
|
+
Description: libXML library version2.
|
|
10
|
+
Requires:
|
|
11
|
+
Libs: -L${libdir} -lxml2
|
|
12
|
+
Libs.private: -L/foo/zlib/1.3/lib -lz -lm
|
|
13
|
+
Cflags: -I${includedir}/libxml2 -ggdb3
|
|
@@ -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: libexslt
|
|
8
|
+
Version: 0.8.21
|
|
9
|
+
Description: EXSLT Extension library
|
|
10
|
+
Requires: libxml-2.0, libxslt
|
|
11
|
+
Cflags: -I${includedir}
|
|
12
|
+
Libs: -L${libdir} -lexslt
|
|
13
|
+
Libs.private: -lm
|
|
@@ -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
|
|
@@ -0,0 +1,159 @@
|
|
|
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, :include_path, :lib_path
|
|
7
|
+
|
|
8
|
+
LIBXML_PCP = File.join(__dir__, "assets", "pkgconf", "libxml2")
|
|
9
|
+
LIBXSLT_PCP = File.join(__dir__, "assets", "pkgconf", "libxslt")
|
|
10
|
+
|
|
11
|
+
def setup
|
|
12
|
+
super
|
|
13
|
+
|
|
14
|
+
@save_env = %w[PATH CPATH LIBRARY_PATH LDFLAGS PKG_CONFIG_PATH].inject({}) do |env, var|
|
|
15
|
+
env.update(var => ENV[var])
|
|
16
|
+
end
|
|
17
|
+
$INCFLAGS = "-I/xxx"
|
|
18
|
+
$LIBPATH = ["xxx"]
|
|
19
|
+
$CFLAGS = "-xxx"
|
|
20
|
+
$CXXFLAGS = "-xxx"
|
|
21
|
+
$libs = "-lxxx"
|
|
22
|
+
|
|
23
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
|
24
|
+
|
|
25
|
+
@recipe = MiniPortile.new("libfoo", "1.0.0").tap do |recipe|
|
|
26
|
+
recipe.logger = StringIO.new
|
|
27
|
+
end
|
|
28
|
+
@include_path = File.join(@recipe.path, "include")
|
|
29
|
+
@lib_path = File.join(@recipe.path, "lib")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def teardown
|
|
33
|
+
FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
|
|
34
|
+
|
|
35
|
+
$INCFLAGS = ""
|
|
36
|
+
$LIBPATH = []
|
|
37
|
+
$CFLAGS = ""
|
|
38
|
+
$CXXFLAGS = ""
|
|
39
|
+
$libs = ""
|
|
40
|
+
@save_env.each do |var, val|
|
|
41
|
+
ENV[var] = val
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
super
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_mkmf_config_recipe_LIBPATH_global_lib_dir_does_not_exist
|
|
48
|
+
recipe.mkmf_config
|
|
49
|
+
|
|
50
|
+
refute_includes($LIBPATH, lib_path)
|
|
51
|
+
refute_includes($libs.split, "-lfoo")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_mkmf_config_recipe_LIBPATH_global
|
|
55
|
+
FileUtils.mkdir_p(lib_path)
|
|
56
|
+
|
|
57
|
+
recipe.mkmf_config
|
|
58
|
+
|
|
59
|
+
assert_includes($LIBPATH, lib_path)
|
|
60
|
+
assert_operator($LIBPATH.index(lib_path), :<, $LIBPATH.index("xxx")) # prepend
|
|
61
|
+
|
|
62
|
+
assert_includes($libs.split, "-lfoo") # note the recipe name is "libfoo"
|
|
63
|
+
assert_match(%r{-lxxx.*-lfoo}, $libs) # append
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_mkmf_config_recipe_INCFLAGS_global_include_dir_does_not_exist
|
|
67
|
+
recipe.mkmf_config
|
|
68
|
+
|
|
69
|
+
refute_includes($INCFLAGS.split, "-I#{include_path}")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_mkmf_config_recipe_INCFLAGS_global
|
|
73
|
+
FileUtils.mkdir_p(include_path)
|
|
74
|
+
|
|
75
|
+
recipe.mkmf_config
|
|
76
|
+
|
|
77
|
+
assert_includes($INCFLAGS.split, "-I#{include_path}")
|
|
78
|
+
assert_match(%r{-I#{include_path}.*-I/xxx}, $INCFLAGS) # prepend
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_mkmf_config_pkgconf_does_not_exist
|
|
82
|
+
assert_raises(ArgumentError) do
|
|
83
|
+
recipe.mkmf_config(pkg: "foo")
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_mkmf_config_pkgconf_LIBPATH_global
|
|
88
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
|
89
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
|
90
|
+
|
|
91
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
|
|
92
|
+
|
|
93
|
+
assert_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
|
|
94
|
+
assert_operator($LIBPATH.index("/foo/libxml2/2.11.5/lib"), :<, $LIBPATH.index("xxx")) # prepend
|
|
95
|
+
|
|
96
|
+
assert_includes($libs.split, "-lxml2")
|
|
97
|
+
assert_match(%r{-lxxx.*-lxml2}, $libs) # append
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def test_mkmf_config_pkgconf_CFLAGS_global
|
|
101
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
|
102
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
|
103
|
+
|
|
104
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
|
|
105
|
+
|
|
106
|
+
assert_includes($INCFLAGS.split, "-I/foo/libxml2/2.11.5/include/libxml2")
|
|
107
|
+
assert_match(%r{-I/foo/libxml2/2.11.5/include/libxml2.*-I/xxx}, $INCFLAGS) # prepend
|
|
108
|
+
|
|
109
|
+
assert_includes($CFLAGS.split, "-ggdb3")
|
|
110
|
+
assert_match(%r{-xxx.*-ggdb3}, $CFLAGS) # prepend
|
|
111
|
+
|
|
112
|
+
assert_includes($CXXFLAGS.split, "-ggdb3")
|
|
113
|
+
assert_match(%r{-xxx.*-ggdb3}, $CXXFLAGS) # prepend
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_mkmf_config_pkgconf_path_accumulation
|
|
117
|
+
# can't get the pkgconf utility to install on windows with ruby 2.3 in CI
|
|
118
|
+
skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
|
|
119
|
+
|
|
120
|
+
(ENV["PKG_CONFIG_PATH"] || "").split(File::PATH_SEPARATOR).tap do |pcpaths|
|
|
121
|
+
refute_includes(pcpaths, LIBXML_PCP)
|
|
122
|
+
refute_includes(pcpaths, LIBXSLT_PCP)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
|
|
126
|
+
|
|
127
|
+
ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
|
|
128
|
+
assert_includes(pcpaths, LIBXML_PCP)
|
|
129
|
+
refute_includes(pcpaths, LIBXSLT_PCP)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
recipe.mkmf_config(pkg: "libxslt", dir: LIBXSLT_PCP)
|
|
133
|
+
|
|
134
|
+
ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
|
|
135
|
+
assert_includes(pcpaths, LIBXML_PCP)
|
|
136
|
+
assert_includes(pcpaths, LIBXSLT_PCP)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
recipe.mkmf_config(pkg: "libexslt", dir: LIBXSLT_PCP)
|
|
140
|
+
|
|
141
|
+
$INCFLAGS.split.tap do |incflags|
|
|
142
|
+
assert_includes(incflags, "-I/foo/libxml2/2.11.5/include/libxml2")
|
|
143
|
+
assert_includes(incflags, "-I/foo/libxslt/1.1.38/include")
|
|
144
|
+
end
|
|
145
|
+
assert_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
|
|
146
|
+
assert_includes($LIBPATH, "/foo/libxslt/1.1.38/lib")
|
|
147
|
+
assert_includes($LIBPATH, "/foo/zlib/1.3/lib") # from `--static`
|
|
148
|
+
$CFLAGS.split.tap do |cflags|
|
|
149
|
+
assert_includes(cflags, "-ggdb3")
|
|
150
|
+
assert_includes(cflags, "-Wno-deprecated-enum-enum-conversion")
|
|
151
|
+
end
|
|
152
|
+
$libs.split.tap do |libflags|
|
|
153
|
+
assert_includes(libflags, "-lxml2")
|
|
154
|
+
assert_includes(libflags, "-lxslt")
|
|
155
|
+
assert_includes(libflags, "-lexslt")
|
|
156
|
+
assert_includes(libflags, "-lz") # from `--static`
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
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.rc1
|
|
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: 2023-
|
|
13
|
+
date: 2023-09-13 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|
|
@@ -123,16 +123,21 @@ files:
|
|
|
123
123
|
- test/assets/gpg-fixtures/data.asc
|
|
124
124
|
- test/assets/gpg-fixtures/data.invalid.asc
|
|
125
125
|
- test/assets/patch 1.diff
|
|
126
|
+
- test/assets/pkgconf/libxml2/libxml-2.0.pc
|
|
127
|
+
- test/assets/pkgconf/libxslt/libexslt.pc
|
|
128
|
+
- test/assets/pkgconf/libxslt/libxslt.pc
|
|
126
129
|
- test/assets/test mini portile-1.0.0/configure
|
|
127
130
|
- test/assets/test-cmake-1.0/CMakeLists.txt
|
|
128
131
|
- test/assets/test-cmake-1.0/hello.c
|
|
129
132
|
- test/assets/test-download-archive.tar.gz
|
|
130
133
|
- test/helper.rb
|
|
134
|
+
- test/test_activate.rb
|
|
131
135
|
- test/test_cmake.rb
|
|
132
136
|
- test/test_cook.rb
|
|
133
137
|
- test/test_digest.rb
|
|
134
138
|
- test/test_download.rb
|
|
135
139
|
- test/test_execute.rb
|
|
140
|
+
- test/test_mkmf_config.rb
|
|
136
141
|
- test/test_proxy.rb
|
|
137
142
|
homepage: https://github.com/flavorjones/mini_portile
|
|
138
143
|
licenses:
|
|
@@ -149,11 +154,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
149
154
|
version: 2.3.0
|
|
150
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
156
|
requirements:
|
|
152
|
-
- - "
|
|
157
|
+
- - ">"
|
|
153
158
|
- !ruby/object:Gem::Version
|
|
154
|
-
version:
|
|
159
|
+
version: 1.3.1
|
|
155
160
|
requirements: []
|
|
156
|
-
rubygems_version: 3.4.
|
|
161
|
+
rubygems_version: 3.4.19
|
|
157
162
|
signing_key:
|
|
158
163
|
specification_version: 4
|
|
159
164
|
summary: Simplistic port-like solution for developers
|
|
@@ -163,14 +168,19 @@ test_files:
|
|
|
163
168
|
- test/assets/gpg-fixtures/data.asc
|
|
164
169
|
- test/assets/gpg-fixtures/data.invalid.asc
|
|
165
170
|
- test/assets/patch 1.diff
|
|
171
|
+
- test/assets/pkgconf/libxml2/libxml-2.0.pc
|
|
172
|
+
- test/assets/pkgconf/libxslt/libexslt.pc
|
|
173
|
+
- test/assets/pkgconf/libxslt/libxslt.pc
|
|
166
174
|
- test/assets/test mini portile-1.0.0/configure
|
|
167
175
|
- test/assets/test-cmake-1.0/CMakeLists.txt
|
|
168
176
|
- test/assets/test-cmake-1.0/hello.c
|
|
169
177
|
- test/assets/test-download-archive.tar.gz
|
|
170
178
|
- test/helper.rb
|
|
179
|
+
- test/test_activate.rb
|
|
171
180
|
- test/test_cmake.rb
|
|
172
181
|
- test/test_cook.rb
|
|
173
182
|
- test/test_digest.rb
|
|
174
183
|
- test/test_download.rb
|
|
175
184
|
- test/test_execute.rb
|
|
185
|
+
- test/test_mkmf_config.rb
|
|
176
186
|
- test/test_proxy.rb
|