rcee_packaged_tarball 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -19
- data/ext/packaged_tarball/extconf.rb +48 -14
- data/lib/rcee/packaged_tarball/version.rb +1 -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: 58b32d8f933c8d02d0e2aa6d39b9a5b5e64458d8546b2a9b069f46f1c1055370
|
4
|
+
data.tar.gz: cf54f67265b8b057a376514dda97df9908c19e2d22747e3c861a393bd69c223f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5db9bc2768d02496f6bd42fba01e82e0d8f311eb2c63333e61751fe9b4848b05afee9f693d93fe802f25e1dfac0f54275ad5ee05e3d1f5c6288f57eb6c17e03
|
7
|
+
data.tar.gz: f1c868c5ebd9f6713f3eac704a07fd02d49d80721f49e049a9ff5ebeaede19524b2da3799106f21fd666ee49d739f64d45dacc5c48c34031c6913ef0d2f6185d
|
data/README.md
CHANGED
@@ -21,38 +21,60 @@ Gem::Specification.new do |spec|
|
|
21
21
|
end
|
22
22
|
```
|
23
23
|
|
24
|
-
The `extconf.rb`
|
24
|
+
The `extconf.rb` is about to get more complicated. To help manage the complexity, we'll use a module with a `.configure` method:
|
25
25
|
|
26
26
|
``` ruby
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
module RCEE
|
28
|
+
module PackagedTarball
|
29
|
+
module ExtConf
|
30
|
+
class << self
|
31
|
+
def configure
|
32
|
+
configure_packaged_libraries
|
33
|
+
create_makefile("rcee/packaged_tarball/packaged_tarball")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
RCEE::PackagedTarball::ExtConf.configure
|
41
|
+
```
|
42
|
+
|
43
|
+
The `ExtConf` contains a method `configure_packaged_libraries` which uses `mini_portile` to download the library (if necessary); verify the checksum; extract the files; configure, compile, and link it; and finally configure `MakeMakefile` to find the headers and the library:
|
44
|
+
|
45
|
+
``` ruby
|
46
|
+
def configure_packaged_libraries
|
47
|
+
recipe = libyaml_recipe
|
33
48
|
|
49
|
+
# ensure libyaml has already been unpacked, configured, and compiled
|
34
50
|
unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
|
35
51
|
recipe.cook
|
36
52
|
end
|
37
53
|
|
54
|
+
# use the packaged libyaml
|
38
55
|
recipe.activate
|
39
56
|
pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
|
40
|
-
end
|
41
|
-
```
|
42
57
|
|
43
|
-
|
58
|
+
# assert that we can build against the packaged libyaml
|
59
|
+
unless have_library("yaml", "yaml_get_version", "yaml.h")
|
60
|
+
abort("\nERROR: *** could not find libyaml development environment ***\n\n")
|
61
|
+
end
|
62
|
+
end
|
44
63
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
64
|
+
def libyaml_recipe
|
65
|
+
MiniPortile.new("yaml", "0.2.5").tap do |recipe|
|
66
|
+
recipe.files = [{
|
67
|
+
url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
|
68
|
+
sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4"
|
69
|
+
}]
|
70
|
+
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
```
|
52
74
|
|
53
|
-
|
75
|
+
Of special note, we're able to use `pkgconfig` to do much of our extension configuration, which allows us to have a pretty clean configuration. This is one advantage to using upstream distributions.
|
54
76
|
|
55
|
-
Note that all of those steps happen *before* the Makefile is created
|
77
|
+
Note that all of those steps happen *before* the Makefile is created, so that the Makefile will contain the appropriate paths and flags to build our extension against libyaml.
|
56
78
|
|
57
79
|
|
58
80
|
## Testing
|
@@ -1,24 +1,58 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
require "mini_portile2"
|
3
3
|
|
4
|
-
|
4
|
+
module RCEE
|
5
|
+
module PackagedTarball
|
6
|
+
module ExtConf
|
7
|
+
PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4",
|
10
|
-
}]
|
9
|
+
class << self
|
10
|
+
def configure
|
11
|
+
configure_packaged_libraries
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
create_makefile("rcee/packaged_tarball/packaged_tarball")
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure_packaged_libraries
|
17
|
+
recipe = libyaml_recipe
|
18
|
+
|
19
|
+
# ensure libyaml has already been unpacked, configured, and compiled
|
20
|
+
unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
|
21
|
+
recipe.cook
|
22
|
+
end
|
23
|
+
|
24
|
+
# use the packaged libyaml
|
25
|
+
recipe.activate
|
26
|
+
pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
|
27
|
+
|
28
|
+
# assert that we can build against the packaged libyaml
|
29
|
+
unless have_library("yaml", "yaml_get_version", "yaml.h")
|
30
|
+
abort("\nERROR: *** could not find libyaml development environment ***\n\n")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def download
|
35
|
+
libyaml_recipe.download
|
36
|
+
end
|
37
|
+
|
38
|
+
def libyaml_recipe
|
39
|
+
MiniPortile.new("yaml", "0.2.5").tap do |recipe|
|
40
|
+
recipe.files = [{
|
41
|
+
url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
|
42
|
+
sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4"
|
43
|
+
}]
|
44
|
+
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
15
49
|
end
|
16
|
-
recipe.activate
|
17
|
-
pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
|
18
50
|
end
|
19
51
|
|
20
|
-
|
21
|
-
|
52
|
+
# run "ruby ./ext/packaged_tarball/extconf.rb -- --download-dependencies" to download the tarball
|
53
|
+
if arg_config("--download-dependencies")
|
54
|
+
RCEE::PackagedTarball::ExtConf.download
|
55
|
+
exit!(0)
|
22
56
|
end
|
23
57
|
|
24
|
-
|
58
|
+
RCEE::PackagedTarball::ExtConf.configure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcee_packaged_tarball
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_portile2
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
|
-
rubygems_version: 3.
|
65
|
+
rubygems_version: 3.4.19
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Example gem demonstrating a basic C extension.
|