rcee_precompiled 0.4.0-x86_64-linux → 0.5.0.1-x86_64-linux

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: 4a3ef03296e0f261f8deb18faec170739ba9f4061add6d19b563801916862541
4
- data.tar.gz: '03533039e35794b8271f5e5b047f9e9c37f6c0bf8347ade78291e1ed9cf7e1ed'
3
+ metadata.gz: 538a132ccae66bc39ee2d05b30e3b996c53b13830abcdda0ab9b13385ea1894b
4
+ data.tar.gz: 2c452f96a1ab671fa59967f2b9dded8aa893b61238aee93e6cdc4795a2ee91a9
5
5
  SHA512:
6
- metadata.gz: 9e3253212bc7337527c20a2445206c6ee9e3d0ade03484f0d22fe2463c20d0c4235eb034209c2ece9d8eda34313f311c09f9614e83e9aafa239065e0b6f1c610
7
- data.tar.gz: 6c50f19b55210d66a1c50396ec1209b6c882a5300e96c6341bd4e2f5425a81d638f7485b571eb11af0157e47701c13568cca0956ef33dd85badf8b21a9ecd66f
6
+ metadata.gz: 48b9f17a3130e4df3ea0b2f50fb25512ca660d520ad39051a47e2d5d8eb8eb149be2c6c7326e1fc89aeaa31c3eeb31a8f5b10f7e53fdc8130f7ed1c9b2b66f00
7
+ data.tar.gz: ab5a81b6383163e7927f9c03fffc5f1aa14eaeb91dafea00eaafcb482e35a083a5a58d6081fa27a81caddc37fb8d68919deb9cecbcf8d41ab6a876cee09344b4
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
 
10
- gem "rake-compiler"
11
- gem "rake-compiler-dock", "~> 1.2.1"
10
+ gem "rake-compiler", "1.2.7"
11
+ gem "rake-compiler-dock", "1.5.0.rc1"
12
12
 
13
13
  gem "minitest", "~> 5.0"
data/README.md CHANGED
@@ -26,7 +26,7 @@ This is really powerful stuff, and once we assume that we can cross-compile reli
26
26
  First, we need to add some features to our `Rake::ExtensionTask` in `Rakefile`:
27
27
 
28
28
  ``` ruby
29
- cross_rubies = ["3.1.0", "3.0.0", "2.7.0", "2.6.0"]
29
+ cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"]
30
30
  cross_platforms = [
31
31
  "x64-mingw32",
32
32
  "x64-mingw-ucrt",
@@ -92,30 +92,33 @@ The top task (or, really, _set_ of tasks) runs on the host system, and invokes t
92
92
  Changes to the `extconf.rb`:
93
93
 
94
94
  ``` ruby
95
- ENV["CC"] = RbConfig::CONFIG["CC"]
95
+ def configure_cross_compilers
96
+ RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
97
+ ENV["CC"] = RbConfig::CONFIG["CC"]
98
+ end
96
99
  ```
97
100
 
98
101
  This makes sure that the cross-compiler is the compiler used within the guest container (and not the native linux compiler).
99
102
 
100
103
  ``` ruby
101
- cross_build_p = enable_config("cross-build")
104
+ def cross_build?
105
+ enable_config("cross-build")
106
+ end
102
107
  ```
103
108
 
104
109
  The cross-compile rake task signals to `extconf.rb` that it's cross-compiling by using a commandline flag that we can inspect. We'll need this for `libyaml` to make sure that set the appropriate flags during precompilation (flags which shouldn't be set when compiling natively).
105
110
 
106
111
  ``` ruby
107
- MiniPortile.new("yaml", "0.2.5").tap do |recipe|
108
- # ...
109
- # configure the environment that MiniPortile will use for subshells
110
- ENV.to_h.dup.tap do |env|
111
- # -fPIC is necessary for linking into a shared library
112
- env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ")
113
- env["SUBDIRS"] = "include src" # libyaml: skip tests
114
-
115
- recipe.configure_options += env.map { |key, value| "#{key}=#{value.strip}" }
112
+ # pass some environment variables to the libyaml configuration for cross-compilation
113
+ if cross_build?
114
+ ENV.to_h.tap do |env|
115
+ # -fPIC is necessary for linking into a shared library
116
+ env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ")
117
+ env["SUBDIRS"] = "include src" # libyaml: skip tests
118
+
119
+ recipe.configure_options += env.map { |key, value| "#{key}=#{value.strip}" }
120
+ end
116
121
  end
117
- # ...
118
- end
119
122
  ```
120
123
 
121
124
  The rest of the extconf changes are related to configuring libyaml at build time. We need to set the -fPIC option so we can mix static and shared libraries together. (This should probably always be set.)
@@ -128,14 +131,14 @@ We have one more small change we'll need to make to how the extension is require
128
131
  lib
129
132
  └── rcee
130
133
  ├── precompiled
131
- │   ├── 2.6
132
- │   │   └── precompiled.so
133
- │   ├── 2.7
134
- │   │   └── precompiled.so
135
134
  │   ├── 3.0
136
135
  │   │   └── precompiled.so
137
136
  │   ├── 3.1
138
137
  │   │   └── precompiled.so
138
+ │   ├── 3.2
139
+ │   │   └── precompiled.so
140
+ │   ├── 3.3
141
+ │   │   └── precompiled.so
139
142
  │   └── version.rb
140
143
  └── precompiled.rb
141
144
  ```
data/Rakefile CHANGED
@@ -6,22 +6,26 @@ require "rake/testtask"
6
6
  require "rake/extensiontask"
7
7
  require "rake_compiler_dock"
8
8
 
9
- cross_rubies = ["3.1.0", "3.0.0", "2.7.0", "2.6.0"]
9
+ cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"]
10
10
  cross_platforms = [
11
11
  "aarch64-linux",
12
+ "aarch64-linux-musl",
12
13
  "arm-linux",
14
+ "arm-linux-musl",
13
15
  "arm64-darwin",
14
16
  "x64-mingw-ucrt",
15
17
  "x64-mingw32",
16
18
  "x86-linux",
19
+ "x86-linux-musl",
17
20
  "x86_64-darwin",
18
21
  "x86_64-linux",
22
+ "x86_64-linux-musl",
19
23
  ]
20
24
  ENV["RUBY_CC_VERSION"] = cross_rubies.join(":")
21
25
 
22
26
  rcee_precompiled_spec = Bundler.load_gemspec("rcee_precompiled.gemspec")
23
27
  Gem::PackageTask.new(rcee_precompiled_spec).define #packaged_tarball version of the gem for platform=ruby
24
- task "package" => cross_platforms.map { |p| "gem:#{p}" } # "package" task for all the native platforms
28
+ task "package" => "gem:all"
25
29
 
26
30
  Rake::TestTask.new(:test) do |t|
27
31
  t.libs << "test"
@@ -1,41 +1,78 @@
1
1
  require "mkmf"
2
2
  require "mini_portile2"
3
3
 
4
- package_root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
4
+ module RCEE
5
+ module Precompiled
6
+ module ExtConf
7
+ PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
5
8
 
6
- RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
7
- ENV["CC"] = RbConfig::CONFIG["CC"]
9
+ class << self
10
+ def configure
11
+ configure_cross_compilers
12
+ configure_packaged_libraries
13
+ create_makefile("rcee/precompiled/precompiled")
14
+ end
8
15
 
9
- cross_build_p = enable_config("cross-build")
16
+ def configure_cross_compilers
17
+ RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
18
+ ENV["CC"] = RbConfig::CONFIG["CC"]
19
+ end
10
20
 
11
- MiniPortile.new("yaml", "0.2.5").tap do |recipe|
12
- recipe.files = [{
13
- url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
14
- sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4",
15
- }]
16
- recipe.target = File.join(package_root_dir, "ports")
21
+ def configure_packaged_libraries
22
+ recipe = libyaml_recipe
17
23
 
18
- # configure the environment that MiniPortile will use for subshells
19
- if cross_build_p
20
- ENV.to_h.tap do |env|
21
- # -fPIC is necessary for linking into a shared library
22
- env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ")
23
- env["SUBDIRS"] = "include src" # libyaml: skip tests
24
+ # pass some environment variables to the libyaml configuration for cross-compilation
25
+ if cross_build?
26
+ ENV.to_h.tap do |env|
27
+ # -fPIC is necessary for linking into a shared library
28
+ env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ")
29
+ env["SUBDIRS"] = "include src" # libyaml: skip tests
24
30
 
25
- recipe.configure_options += env.map { |key, value| "#{key}=#{value.strip}" }
26
- end
27
- end
31
+ recipe.configure_options += env.map { |key, value| "#{key}=#{value.strip}" }
32
+ end
33
+ end
28
34
 
29
- unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
30
- recipe.cook
31
- end
35
+ # ensure libyaml has already been unpacked, configured, and compiled
36
+ unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
37
+ recipe.cook
38
+ end
39
+
40
+ # use the packaged libyaml
41
+ recipe.activate
42
+ pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
43
+
44
+ # assert that we can build against the packaged libyaml
45
+ unless have_library("yaml", "yaml_get_version", "yaml.h")
46
+ abort("\nERROR: *** could not find libyaml development environment ***\n\n")
47
+ end
48
+ end
32
49
 
33
- recipe.activate
34
- pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
50
+ def cross_build?
51
+ enable_config("cross-build")
52
+ end
53
+
54
+ def download
55
+ libyaml_recipe.download
56
+ end
57
+
58
+ def libyaml_recipe
59
+ MiniPortile.new("yaml", "0.2.5").tap do |recipe|
60
+ recipe.files = [{
61
+ url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
62
+ sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4"
63
+ }]
64
+ recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
35
70
  end
36
71
 
37
- unless have_library("yaml", "yaml_get_version", "yaml.h")
38
- abort("\nERROR: *** could not find libyaml development environment ***\n\n")
72
+ # run "ruby ./ext/precompiled/extconf.rb -- --download-dependencies" to download the tarball
73
+ if arg_config("--download-dependencies")
74
+ RCEE::Precompiled::ExtConf.download
75
+ exit!(0)
39
76
  end
40
77
 
41
- create_makefile("rcee/precompiled/precompiled")
78
+ RCEE::Precompiled::ExtConf.configure
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RCEE
4
4
  module Precompiled
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0.1"
6
6
  end
7
7
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.summary = "Example gem demonstrating a basic C extension."
16
16
  spec.description = "Part of a project to explain how Ruby C extensions work."
17
17
  spec.homepage = "https://github.com/flavorjones/ruby-c-extensions-explained"
18
- spec.required_ruby_version = ">= 2.6.0"
18
+ spec.required_ruby_version = ">= 3.0.0"
19
19
  spec.license = "MIT"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcee_precompiled
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Mike Dalessio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-19 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Part of a project to explain how Ruby C extensions work.
14
14
  email:
@@ -25,17 +25,17 @@ files:
25
25
  - ext/precompiled/precompiled.c
26
26
  - ext/precompiled/precompiled.h
27
27
  - lib/rcee/precompiled.rb
28
- - lib/rcee/precompiled/2.6/precompiled.so
29
- - lib/rcee/precompiled/2.7/precompiled.so
30
28
  - lib/rcee/precompiled/3.0/precompiled.so
31
29
  - lib/rcee/precompiled/3.1/precompiled.so
30
+ - lib/rcee/precompiled/3.2/precompiled.so
31
+ - lib/rcee/precompiled/3.3/precompiled.so
32
32
  - lib/rcee/precompiled/version.rb
33
33
  - rcee_precompiled.gemspec
34
34
  homepage: https://github.com/flavorjones/ruby-c-extensions-explained
35
35
  licenses:
36
36
  - MIT
37
37
  metadata: {}
38
- post_install_message:
38
+ post_install_message:
39
39
  rdoc_options: []
40
40
  require_paths:
41
41
  - lib
@@ -43,18 +43,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '2.6'
46
+ version: '3.0'
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
- version: 3.2.dev
49
+ version: 3.4.dev
50
50
  required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  requirements: []
56
- rubygems_version: 3.3.4
57
- signing_key:
56
+ rubygems_version: 3.3.26
57
+ signing_key:
58
58
  specification_version: 4
59
59
  summary: Example gem demonstrating a basic C extension.
60
60
  test_files: []