rcee_precompiled 0.1.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +13 -0
- data/README.md +2 -0
- data/Rakefile +69 -0
- data/ext/precompiled/extconf.rb +40 -0
- data/ext/precompiled/precompiled.c +25 -0
- data/ext/precompiled/precompiled.h +7 -0
- data/lib/rcee/precompiled/2.5/precompiled.bundle +0 -0
- data/lib/rcee/precompiled/2.6/precompiled.bundle +0 -0
- data/lib/rcee/precompiled/2.7/precompiled.bundle +0 -0
- data/lib/rcee/precompiled/3.0/precompiled.bundle +0 -0
- data/lib/rcee/precompiled/version.rb +7 -0
- data/lib/rcee/precompiled.rb +23 -0
- data/rcee_precompiled.gemspec +42 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ff2a0fb01dfe21ea765be928b094b9e3372e85d57c6886d3e98e1753d8f34602
|
4
|
+
data.tar.gz: '0999c42935488a6033b3524015cd843efc874892bc92cd74b409ccd140dfd974'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc2ff74a9040da02dd3fd2fae273ebb38aad5fefafa95a57531253d73bc2a379a10ca321be3e09e26ccc9d2e61d4b663a24636c3138df0832a3921e12c76cef4
|
7
|
+
data.tar.gz: fff9b7d04dbfbf7bc256ebd0c015db1fbfef991fb7fc262d5a8c4b9ba00b22a6065e4f438512f9014d9565039bec00329e4b0a52617826524623846298e0498a
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
rcee_precompiled_spec = Bundler.load_gemspec("rcee_precompiled.gemspec")
|
7
|
+
|
8
|
+
Rake::TestTask.new(:test) do |t|
|
9
|
+
t.libs << "test"
|
10
|
+
t.libs << "lib"
|
11
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
12
|
+
end
|
13
|
+
|
14
|
+
# "gem" task for vanilla packaged (tarball)
|
15
|
+
require "rubygems/package_task"
|
16
|
+
Gem::PackageTask.new(rcee_precompiled_spec).define
|
17
|
+
|
18
|
+
require "rake/extensiontask"
|
19
|
+
require "rake_compiler_dock"
|
20
|
+
|
21
|
+
cross_rubies = ["3.0.0", "2.7.0", "2.6.0", "2.5.0"]
|
22
|
+
cross_platforms = ["x64-mingw32", "x86_64-linux", "x86_64-darwin", "arm64-darwin"]
|
23
|
+
|
24
|
+
ENV["RUBY_CC_VERSION"] = cross_rubies.join(":")
|
25
|
+
|
26
|
+
|
27
|
+
Rake::ExtensionTask.new("precompiled", rcee_precompiled_spec) do |ext|
|
28
|
+
ext.lib_dir = "lib/rcee/precompiled"
|
29
|
+
ext.cross_compile = true
|
30
|
+
ext.cross_platform = cross_platforms
|
31
|
+
ext.cross_config_options << "--enable-cross-build" # so extconf.rb knows we're cross-compiling
|
32
|
+
ext.cross_compiling do |spec|
|
33
|
+
# remove things not needed for precompiled gems
|
34
|
+
spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' }
|
35
|
+
spec.files.reject! { |file| File.fnmatch?("*.tar.gz", file) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
namespace "gem" do
|
40
|
+
cross_platforms.each do |platform|
|
41
|
+
desc "build native gem for #{platform}"
|
42
|
+
task platform do
|
43
|
+
RakeCompilerDock.sh(<<~EOF, platform: platform)
|
44
|
+
gem install bundler --no-document &&
|
45
|
+
bundle &&
|
46
|
+
bundle exec rake gem:#{platform}:buildit
|
47
|
+
EOF
|
48
|
+
end
|
49
|
+
|
50
|
+
namespace platform do
|
51
|
+
# this runs in the rake-compiler-dock docker container
|
52
|
+
task "buildit" do
|
53
|
+
# use Task#invoke because the pkg/*gem task is defined at runtime
|
54
|
+
Rake::Task["native:#{platform}"].invoke
|
55
|
+
Rake::Task["pkg/#{rcee_precompiled_spec.full_name}-#{Gem::Platform.new(platform).to_s}.gem"].invoke
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "build native gem for all platforms"
|
61
|
+
multitask "all" => [cross_platforms, "gem"].flatten
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
CLOBBER.add("ports")
|
66
|
+
CLEAN.add("{ext,lib}/**/*.{o,so}")
|
67
|
+
|
68
|
+
task build: :compile
|
69
|
+
task default: %i[clobber compile test]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "mkmf"
|
2
|
+
require "mini_portile2"
|
3
|
+
|
4
|
+
package_root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
5
|
+
|
6
|
+
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
|
7
|
+
ENV["CC"] = RbConfig::CONFIG["CC"]
|
8
|
+
|
9
|
+
# not needed for libyaml, but generally useful to know whether we're cross-compiling
|
10
|
+
cross_build_p = enable_config("cross-build")
|
11
|
+
|
12
|
+
MiniPortile.new("yaml", "0.2.5").tap do |recipe|
|
13
|
+
recipe.files = [{
|
14
|
+
url: "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
|
15
|
+
sha256: "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4",
|
16
|
+
}]
|
17
|
+
recipe.target = File.join(package_root_dir, "ports")
|
18
|
+
|
19
|
+
# configure the environment that MiniPortile will use for subshells
|
20
|
+
ENV.to_h.dup.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
|
+
|
25
|
+
recipe.configure_options += env.map { |key, value| "#{key}=#{value.strip}" }
|
26
|
+
end
|
27
|
+
|
28
|
+
unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
|
29
|
+
recipe.cook
|
30
|
+
end
|
31
|
+
|
32
|
+
recipe.activate
|
33
|
+
pkg_config(File.join(recipe.path, "lib", "pkgconfig", "yaml-0.1.pc"))
|
34
|
+
end
|
35
|
+
|
36
|
+
unless have_library("yaml", "yaml_get_version", "yaml.h")
|
37
|
+
abort("\nERROR: *** could not find libyaml development environment ***\n\n")
|
38
|
+
end
|
39
|
+
|
40
|
+
create_makefile("rcee/precompiled/precompiled")
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#include "precompiled.h"
|
2
|
+
|
3
|
+
VALUE rb_mRCEE;
|
4
|
+
VALUE rb_mPrecompiled;
|
5
|
+
VALUE rb_cPrecompiledExtension;
|
6
|
+
|
7
|
+
static VALUE
|
8
|
+
rb_precompiled_extension_class_do_something(VALUE self)
|
9
|
+
{
|
10
|
+
int major, minor, patch;
|
11
|
+
|
12
|
+
yaml_get_version(&major, &minor, &patch);
|
13
|
+
|
14
|
+
return rb_sprintf("libyaml version %d.%d.%d", major, minor, patch);
|
15
|
+
}
|
16
|
+
|
17
|
+
void
|
18
|
+
Init_precompiled(void)
|
19
|
+
{
|
20
|
+
rb_mRCEE = rb_define_module("RCEE");
|
21
|
+
rb_mPrecompiled = rb_define_module_under(rb_mRCEE, "Precompiled");
|
22
|
+
rb_cPrecompiledExtension = rb_define_class_under(rb_mPrecompiled, "Extension", rb_cObject);
|
23
|
+
rb_define_singleton_method(rb_cPrecompiledExtension, "do_something",
|
24
|
+
rb_precompiled_extension_class_do_something, 0);
|
25
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "precompiled/version"
|
4
|
+
|
5
|
+
begin
|
6
|
+
# load the precompiled extension file
|
7
|
+
ruby_version = /(\d+\.\d+)/.match(::RUBY_VERSION)
|
8
|
+
require_relative "precompiled/#{ruby_version}/precompiled"
|
9
|
+
rescue LoadError
|
10
|
+
# fall back to the extension compiled upon installation.
|
11
|
+
# use "require" instead of "require_relative" because non-native gems will place C extension files
|
12
|
+
# in Gem::BasicSpecification#extension_dir after compilation (during normal installation), which
|
13
|
+
# is in $LOAD_PATH but not necessarily relative to this file
|
14
|
+
# (see https://github.com/sparklemotion/nokogiri/issues/2300 for more)
|
15
|
+
require "rcee/precompiled/precompiled"
|
16
|
+
end
|
17
|
+
|
18
|
+
module RCEE
|
19
|
+
module Precompiled
|
20
|
+
class Error < StandardError; end
|
21
|
+
# Your code goes here...
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/rcee/precompiled/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rcee_precompiled"
|
7
|
+
spec.version = RCEE::Precompiled::VERSION
|
8
|
+
spec.authors = ["Mike Dalessio"]
|
9
|
+
spec.email = ["mike.dalessio@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Example gem demonstrating a basic C extension."
|
12
|
+
spec.description = "Part of a project to explain how Ruby C extensions work."
|
13
|
+
spec.homepage = "https://github.com/flavorjones/ruby-c-extensions-explained"
|
14
|
+
spec.required_ruby_version = ">= 2.5.0"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = [
|
20
|
+
".gitignore",
|
21
|
+
"Gemfile",
|
22
|
+
"README.md",
|
23
|
+
"Rakefile",
|
24
|
+
"ext/precompiled/extconf.rb",
|
25
|
+
"ext/precompiled/precompiled.c",
|
26
|
+
"ext/precompiled/precompiled.h",
|
27
|
+
"lib/rcee/precompiled.rb",
|
28
|
+
"lib/rcee/precompiled/version.rb",
|
29
|
+
"ports/archives/yaml-0.2.5.tar.gz",
|
30
|
+
"rcee_precompiled.gemspec",
|
31
|
+
]
|
32
|
+
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
spec.extensions = ["ext/precompiled/extconf.rb"]
|
37
|
+
|
38
|
+
spec.add_dependency "mini_portile2"
|
39
|
+
|
40
|
+
# For more information and examples about making a new gem, checkout our
|
41
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rcee_precompiled
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: x86_64-darwin
|
6
|
+
authors:
|
7
|
+
- Mike Dalessio
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Part of a project to explain how Ruby C extensions work.
|
14
|
+
email:
|
15
|
+
- mike.dalessio@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- ext/precompiled/extconf.rb
|
25
|
+
- ext/precompiled/precompiled.c
|
26
|
+
- ext/precompiled/precompiled.h
|
27
|
+
- lib/rcee/precompiled.rb
|
28
|
+
- lib/rcee/precompiled/2.5/precompiled.bundle
|
29
|
+
- lib/rcee/precompiled/2.6/precompiled.bundle
|
30
|
+
- lib/rcee/precompiled/2.7/precompiled.bundle
|
31
|
+
- lib/rcee/precompiled/3.0/precompiled.bundle
|
32
|
+
- lib/rcee/precompiled/version.rb
|
33
|
+
- rcee_precompiled.gemspec
|
34
|
+
homepage: https://github.com/flavorjones/ruby-c-extensions-explained
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.5'
|
47
|
+
- - "<"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.1.dev
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubygems_version: 3.2.3
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: Example gem demonstrating a basic C extension.
|
60
|
+
test_files: []
|