bytebuffer 0.1.1 → 0.1.3

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: 8eea8692ed857ea29116f8c6fe67247ccaebd7ae9b74881952715ca566810fed
4
- data.tar.gz: 8dd61f4de9f5d424e6af310604386cc4386c9cb0e157eb39a233bf45980530f2
3
+ metadata.gz: 84a49dc9a366a0926ea0677547554188adae538ddfba8ba42f74e68e621af3f0
4
+ data.tar.gz: 161a564f57ecb7da7ca3ef9eb8e169b92a1bd81b0ddc9abf7f0ac7e47e7c77f9
5
5
  SHA512:
6
- metadata.gz: c7641fc331f1eb535320937405685cb43076ee2f90610bb96b813917aa8658d389b111c8d9a59e2b4ace87f9d65ed12eaab98066784f56f721049ba8f73e6355
7
- data.tar.gz: 9a16aa790e47b0ccf02eb741b6962453d1d8e4e69a8542d40b665179e2ce30594bdfcbd09d930ae5748449f730a5c105c2cdb864ec1672034f9c6e783c5612b9
6
+ metadata.gz: 330bf79aaf86a4637321a581ff8574033094980575a8223876f9209c922ff049a82aea5e4ba983d32a454d8ab263f9a5db1273da244e0ae0cde3eaff239bc241
7
+ data.tar.gz: d2f423bc467494d1193ae7796ac3b40297ed1a880e7c0940539e034c02e1aec48cf9dc34aa1ae134185a3eb4c4283b9d829d5e5e8ef21c1465658e63ddf167bb
@@ -7,47 +7,8 @@ on:
7
7
  types: [released]
8
8
 
9
9
  jobs:
10
- Build:
11
- runs-on: ${{ matrix.os }}
12
- strategy:
13
- matrix:
14
- os: [ubuntu-latest, windows-latest, macos-latest]
15
- include:
16
- - os: windows-latest
17
- name: windows
18
- path: "ext/libext.dll"
19
- - os: ubuntu-latest
20
- name: linux
21
- path: "ext/libext.so"
22
- - os: macos-latest
23
- name: macos
24
- path: "ext/libext.dylib"
25
- steps:
26
- - uses: actions/checkout@v4
27
-
28
- - name: Setup Ruby
29
- uses: ruby/setup-ruby@v1
30
- with:
31
- ruby-version: '3.3'
32
- - run: bundle install
33
-
34
- - name: Setup Rust
35
- uses: hecrj/setup-rust-action@v2
36
- with:
37
- rust-version: stable
38
-
39
- - name: Build extension
40
- run: bundle exec rake gem:build
41
-
42
- - name: Upload artifact
43
- uses: actions/upload-artifact@v4
44
- with:
45
- name: extension-${{ matrix.name }}
46
- path: ${{ matrix.path }}
47
-
48
10
  Publish:
49
11
  runs-on: ubuntu-latest
50
- needs: [Build]
51
12
  permissions:
52
13
  id-token: write
53
14
  contents: write
@@ -66,24 +27,6 @@ jobs:
66
27
  with:
67
28
  rust-version: stable
68
29
 
69
- - name: Download build linux artifacts
70
- uses: actions/download-artifact@v4
71
- with:
72
- name: extension-linux
73
- path: ext/libext.so
74
-
75
- - name: Download build windows artifacts
76
- uses: actions/download-artifact@v4
77
- with:
78
- name: extension-windows
79
- path: ext/libext.dll
80
-
81
- - name: Download build macos artifacts
82
- uses: actions/download-artifact@v4
83
- with:
84
- name: extension-macos
85
- path: ext/libext.dylib
86
-
87
30
  - name: Build package gem
88
31
  run: bundle exec rake gem:package
89
32
 
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: Rspec and Cargo Test
3
+
4
+ on:
5
+ pull_request:
6
+ types: [opened, synchronize]
7
+ branches: [main]
8
+ push:
9
+ branches: [main]
10
+
11
+ jobs:
12
+ BuildAndTest:
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ max-parallel: 3
16
+ matrix:
17
+ os: [ ubuntu-latest, macos-latest ]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ ref: ${{ github.ref }}
22
+
23
+ - name: Setup Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: '3.3'
27
+ - run: bundle install
28
+
29
+ - name: Setup Rust
30
+ uses: hecrj/setup-rust-action@v2
31
+ with:
32
+ rust-version: stable
33
+
34
+ - name: Build extension
35
+ run: |
36
+ bundle exec rake gem:compile
37
+ bundle exec rake gem:patch
38
+
39
+ - name: Run Rspec
40
+ run: bundle exec rake test:rspec
41
+
42
+ - name: Run Cargo test
43
+ run: bundle exec rake test:ext
@@ -2,6 +2,13 @@
2
2
  # It is not intended for manual editing.
3
3
  version = 3
4
4
 
5
+ [[package]]
6
+ name = "bytebuffer"
7
+ version = "0.1.0"
8
+ dependencies = [
9
+ "bytebuffer 2.2.0",
10
+ ]
11
+
5
12
  [[package]]
6
13
  name = "bytebuffer"
7
14
  version = "2.2.0"
@@ -16,10 +23,3 @@ name = "byteorder"
16
23
  version = "1.5.0"
17
24
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
25
  checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
19
-
20
- [[package]]
21
- name = "ext"
22
- version = "0.1.0"
23
- dependencies = [
24
- "bytebuffer",
25
- ]
data/Cargo.toml ADDED
@@ -0,0 +1,3 @@
1
+ [workspace]
2
+ members = ["./ext/bytebuffer"]
3
+ resolver = "2"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bytebuffer (0.1.1)
4
+ bytebuffer (0.1.3)
5
5
  ffi (~> 1.17)
6
6
 
7
7
  GEM
@@ -21,6 +21,9 @@ GEM
21
21
  ffi (1.17.0-x86_64-linux-gnu)
22
22
  ffi (1.17.0-x86_64-linux-musl)
23
23
  rake (13.2.1)
24
+ rake-compiler (1.2.7)
25
+ rake
26
+ rb_sys (0.9.98)
24
27
  rspec (3.13.0)
25
28
  rspec-core (~> 3.13.0)
26
29
  rspec-expectations (~> 3.13.0)
@@ -59,6 +62,8 @@ PLATFORMS
59
62
  DEPENDENCIES
60
63
  bytebuffer!
61
64
  rake (~> 13.0)
65
+ rake-compiler (~> 1.2)
66
+ rb_sys (~> 0.9)
62
67
  rspec (~> 3.12)
63
68
  simplecov
64
69
  webrick (~> 1.7)
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/bytebuffer.svg)](https://badge.fury.io/rb/bytebuffer)
2
+
1
3
  # ByteBuffer
2
4
  The `ByteBuffer` Ruby gem provides a powerful and flexible interface for buffered IO data, wrapping the [bytebuffer](https://crates.io/crates/bytebuffer) crate using FFI.
3
5
 
data/Rakefile CHANGED
@@ -3,43 +3,84 @@ require 'bundler/gem_tasks'
3
3
  require 'ffi'
4
4
  require 'rake'
5
5
  require 'rake/testtask'
6
+ require 'rb_sys/extensiontask'
6
7
  require 'rspec/core/rake_task'
7
8
  require 'rubygems'
8
9
  require 'rubygems/package_task'
9
10
 
11
+ GEM_SPEC = Gem::Specification.load('bytebuffer.gemspec')
12
+
10
13
  namespace :gem do
11
- desc 'Build the Gem extensions'
12
- task :build do
13
- raise "Install rustc along with Cargo before running this rake task." if !system('cargo --version') || !system('rustc --version')
14
14
 
15
- FileUtils.chdir("ext/") do
16
- target = case RUBY_PLATFORM
17
- when /darwin/ then 'aarch64-apple-darwin'
18
- when /linux/ then 'x86_64-unknown-linux-gnu'
19
- when /mswin|mingw/ then 'x86_64-pc-windows-msvc'
20
- else 'x86_64-unknown-linux-gnu'
21
- end
15
+ desc 'Clean up the Gem build environment. Note: This command indiscriminately removes all .so, and .bundle files in subdirectories.'
16
+ task :clean do
17
+ FileUtils.rm_rf(%w(./tmp ./pkg ./target))
22
18
 
23
- target_path = "./build/#{target}/release/#{RUBY_PLATFORM.match?(/mswin|mingw/) ? 'ext' : 'libext'}.#{FFI::Platform::LIBSUFFIX}"
19
+ case FFI::Platform::OS
20
+ when 'linux' then FileUtils.rm_r(Dir['./**/*.so'])
21
+ when 'darwin' then FileUtils.rm_r(Dir['./**/*.bundle'])
22
+ else system("rm -r ./**/*.so")
23
+ end
24
+ end
24
25
 
25
- FileUtils.mkdir("build")
26
+ desc 'Compile and install the native extension'
27
+ task compile: %i(clean) do
28
+ RbSys::ExtensionTask.new('bytebuffer', GEM_SPEC) do |ext|
29
+ ext.source_pattern = "*.{rs,toml,lock,rb}"
30
+ ext.ext_dir = "#{File.dirname(__FILE__)}/ext/bytebuffer"
31
+ ext.cross_platform = %w[
32
+ aarch64-linux
33
+ arm64-darwin
34
+ x86_64-darwin
35
+ x86_64-linux
36
+ x86_64-linux-musl
37
+ ]
38
+
39
+ ext.cross_compile = true
40
+ ext.lib_dir = "lib"
41
+ end
26
42
 
27
- system("cargo build --release --target=#{target} --target-dir=#{FileUtils.pwd}/build")
43
+ Rake::Task["compile"].invoke
44
+ end
28
45
 
29
- FileUtils.cp(target_path, "./libext.#{FFI::Platform::LIBSUFFIX}")
46
+ desc 'Apply platform patches'
47
+ task :patch do
48
+ working_dir = File.dirname(__FILE__)
49
+ target = case RUBY_PLATFORM
50
+ when /darwin/ then 'darwin'
51
+ when /linux/ then 'linux'
52
+ end
53
+ patch_dir = "#{working_dir}/lib/bytebuffer/patch/#{target}"
54
+ unless !File.directory?(patch_dir) || Dir.empty?(patch_dir)
55
+ puts "Applying platform patches for #{target}"
56
+
57
+ FileUtils.chdir(patch_dir) do |dir|
58
+ Dir["#{dir}/*.patch"].sort.each do |patch|
59
+ puts "Applying patch: #{patch}"
60
+ system("patch #{working_dir}/lib/bytebuffer.rb #{patch}")
61
+ end
62
+ end
30
63
  end
31
64
  end
32
65
 
33
- desc 'Clean up the Gem build environment.'
34
- task :clean do
35
- FileUtils.rm_rf('pkg/')
36
- FileUtils.rm_rf('ext/build/')
66
+ desc 'Revert platform patches'
67
+ task :revert do
68
+ working_dir = File.dirname(__FILE__)
69
+ target = case RUBY_PLATFORM
70
+ when /darwin/ then 'darwin'
71
+ when /linux/ then 'linux'
72
+ end
73
+
74
+ FileUtils.chdir("#{working_dir}/lib/bytebuffer/patch/#{target}") do |dir|
75
+ Dir["#{dir}/*.patch"].sort.each do |patch|
76
+ puts "Applying patch: #{patch}"
77
+ system("patch -R #{working_dir}/lib/bytebuffer.rb #{patch}")
78
+ end
79
+ end
37
80
  end
38
81
 
39
82
  desc 'Package the Gem package'
40
- task :package do
41
- load('bytebuffer.gemspec')
42
-
83
+ task package: %i(compile gem:patch) do
43
84
  Gem::PackageTask.new(GEM_SPEC) do |pkg|
44
85
  pkg.need_tar_bz2 = true
45
86
  end
@@ -53,7 +94,7 @@ namespace :docs do
53
94
 
54
95
  YARD::Rake::YardocTask.new do |t|
55
96
  t.name = 'generate'
56
- t.files = ['lib/**/*.rb']
97
+ t.files = %w(lib/**/*.rb)
57
98
  end
58
99
 
59
100
  task serve: %i[docs:generate] do
@@ -83,8 +124,6 @@ namespace :test do
83
124
  task :ext do
84
125
  raise "Install rustc along with Cargo before running this rake task." if !system('cargo --version') || !system('rustc --version')
85
126
 
86
- FileUtils.chdir("ext/") do
87
- system("cargo test")
88
- end
127
+ system("cargo test")
89
128
  end
90
- end
129
+ end
data/bytebuffer.gemspec CHANGED
@@ -1,23 +1,31 @@
1
1
  require_relative 'lib/bytebuffer/version'
2
2
 
3
- GEM_SPEC = Gem::Specification.new do |spec|
3
+ Gem::Specification.new do |spec|
4
4
  spec.name = 'bytebuffer'
5
5
  spec.version = ByteBuffer::VERSION
6
6
  spec.summary = 'A gem wrapping the bytebuffer crate using FFI.'
7
7
  spec.description = 'A gem that provides a ByteBuffer class based on the bytebuffer rust crate.'
8
+ spec.homepage = 'https://github.com/sickday/bytebuffer-rb'
8
9
  spec.license = 'BSD-3-Clause'
9
10
  spec.author = 'Patrick W.'
10
11
  spec.email = 'Sickday@pm.me'
11
12
 
13
+ spec.metadata = {
14
+ "homepage_uri" => 'https://github.com/sickday/bytebuffer-rb',
15
+ "documentation_uri" => 'https://sickday.github.io/bytebuffer-rb/'
16
+ }
17
+
12
18
  spec.required_ruby_version = '>= 3.1.0'
13
19
 
14
20
  spec.add_runtime_dependency 'ffi', '~> 1.17'
15
21
 
16
22
  spec.add_development_dependency 'rake', '~> 13.0'
23
+ spec.add_development_dependency 'rake-compiler', '~> 1.2'
24
+ spec.add_development_dependency 'rb_sys', '~> 0.9'
17
25
  spec.add_development_dependency 'rspec', '~> 3.12'
18
26
 
19
- spec.extensions = "ext/extconf.rb"
20
- spec.require_paths = ['lib']
27
+ spec.extensions = %w(ext/bytebuffer/extconf.rb)
28
+ spec.require_paths = %w(lib)
21
29
 
22
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + Dir["ext/*.so"] + Dir["ext/*.dylib"] + Dir["ext/*.dll"]
30
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|git)/}) }
23
31
  end
@@ -1,7 +1,9 @@
1
1
  [package]
2
- name = "ext"
2
+ name = "bytebuffer"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
+ authors = ["Patrick Worlds <sickday@pm.me>"]
6
+ publish = false
5
7
 
6
8
  [lib]
7
9
  crate-type = ["cdylib"]
@@ -0,0 +1,9 @@
1
+ require "mkmf"
2
+ require "rb_sys/mkmf"
3
+
4
+ create_rust_makefile("bytebuffer") do |bb|
5
+ bb.profile = ENV.fetch("RB_SYS_CARGO_PROFILE", :dev).to_sym
6
+ bb.ext_dir = "."
7
+ bb.clean_after_install = true
8
+ bb.auto_install_rust_toolchain = true
9
+ end
@@ -0,0 +1,31 @@
1
+ --- lib/bytebuffer.rb.orig 2024-07-20 14:25:37
2
+ +++ lib/bytebuffer.rb 2024-07-20 14:26:17
3
+ @@ -178,11 +178,14 @@
4
+
5
+ # Read a single 8-bit unsigned integer from the {ByteBuffer}.
6
+ # @return [Integer] the read value.
7
+ - def read_u8; ByteBufferExtension.read_u8(@ptr); end
8
+ + def read_u8; ByteBufferExtension.read_u8(@ptr) & 0xff; end
9
+
10
+ # Read a single 8-bit signed integer from the {ByteBuffer}.
11
+ # @return [Integer] the read value.
12
+ - def read_i8; ByteBufferExtension.read_i8(@ptr); end
13
+ + def read_i8
14
+ + v=ByteBufferExtension.read_i8(@ptr)
15
+ + (v&(0xff/2))-(v&(0xff/2+1))
16
+ + end
17
+
18
+ # Read a single 16-bit unsigned integer from the {ByteBuffer}.
19
+ # @return [Integer] the read value.
20
+ @@ -190,7 +193,10 @@
21
+
22
+ # Read a single 16-bit signed integer from the {ByteBuffer}.
23
+ # @return [Integer] the read value.
24
+ - def read_i16; ByteBufferExtension.read_i16(@ptr); end
25
+ + def read_i16
26
+ + v=ByteBufferExtension.read_i16(@ptr)
27
+ + (v&(0xffff/2))-(v&(0xffff/2+1))
28
+ + end
29
+
30
+ # Read a single 32-bit unsigned integer from the {ByteBuffer}.
31
+ # @return [Integer] the read value.
@@ -1,5 +1,5 @@
1
1
  class ByteBuffer
2
2
  # @!attribute [r] VERSION
3
3
  # @return [Integer] version number of the library
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
data/lib/bytebuffer.rb CHANGED
@@ -5,7 +5,11 @@ require_relative 'bytebuffer/version'
5
5
  module ByteBufferExtension
6
6
  extend FFI::Library
7
7
 
8
- ffi_lib("ext/libext.#{FFI::Platform::LIBSUFFIX}")
8
+ case FFI::Platform::OS
9
+ when 'linux' then ffi_lib ["#{File.dirname(__FILE__)}/bytebuffer.so"]
10
+ when 'darwin' then ffi_lib ["#{File.dirname(__FILE__)}/bytebuffer.bundle"]
11
+ else ffi_lib ["#{File.dirname(__FILE__)}/bytebuffer.so"]
12
+ end
9
13
 
10
14
  attach_function(:new, :new, [], :pointer)
11
15
  attach_function(:from_bytes, :from_bytes, [:pointer, :int], :pointer)
@@ -173,11 +177,14 @@ class ByteBuffer
173
177
 
174
178
  # Read a single 8-bit unsigned integer from the {ByteBuffer}.
175
179
  # @return [Integer] the read value.
176
- def read_u8; ByteBufferExtension.read_u8(@ptr); end
180
+ def read_u8; ByteBufferExtension.read_u8(@ptr) & 0xff; end
177
181
 
178
182
  # Read a single 8-bit signed integer from the {ByteBuffer}.
179
183
  # @return [Integer] the read value.
180
- def read_i8; ByteBufferExtension.read_i8(@ptr); end
184
+ def read_i8
185
+ v=ByteBufferExtension.read_i8(@ptr)
186
+ (v&(0xff/2))-(v&(0xff/2+1))
187
+ end
181
188
 
182
189
  # Read a single 16-bit unsigned integer from the {ByteBuffer}.
183
190
  # @return [Integer] the read value.
@@ -185,7 +192,10 @@ class ByteBuffer
185
192
 
186
193
  # Read a single 16-bit signed integer from the {ByteBuffer}.
187
194
  # @return [Integer] the read value.
188
- def read_i16; ByteBufferExtension.read_i16(@ptr); end
195
+ def read_i16
196
+ v=ByteBufferExtension.read_i16(@ptr)
197
+ (v&(0xffff/2))-(v&(0xffff/2+1))
198
+ end
189
199
 
190
200
  # Read a single 32-bit unsigned integer from the {ByteBuffer}.
191
201
  # @return [Integer] the read value.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bytebuffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick W.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-13 00:00:00.000000000 Z
11
+ date: 2024-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rb_sys
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -56,28 +84,32 @@ description: A gem that provides a ByteBuffer class based on the bytebuffer rust
56
84
  email: Sickday@pm.me
57
85
  executables: []
58
86
  extensions:
59
- - ext/extconf.rb
87
+ - ext/bytebuffer/extconf.rb
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - ".github/workflows/pages.yml"
63
91
  - ".github/workflows/publish.yml"
92
+ - ".github/workflows/test.yml"
93
+ - Cargo.lock
94
+ - Cargo.toml
64
95
  - Gemfile
65
96
  - Gemfile.lock
66
97
  - LICENSE
67
98
  - README.md
68
99
  - Rakefile
69
100
  - bytebuffer.gemspec
70
- - ext/Cargo.lock
71
- - ext/Cargo.toml
72
- - ext/Makefile
73
- - ext/extconf.rb
74
- - ext/src/lib.rs
101
+ - ext/bytebuffer/Cargo.toml
102
+ - ext/bytebuffer/extconf.rb
103
+ - ext/bytebuffer/src/lib.rs
75
104
  - lib/bytebuffer.rb
105
+ - lib/bytebuffer/patch/linux/bytebuffer-read_i8-read_i16-1721497558.patch
76
106
  - lib/bytebuffer/version.rb
77
- homepage:
107
+ homepage: https://github.com/sickday/bytebuffer-rb
78
108
  licenses:
79
109
  - BSD-3-Clause
80
- metadata: {}
110
+ metadata:
111
+ homepage_uri: https://github.com/sickday/bytebuffer-rb
112
+ documentation_uri: https://sickday.github.io/bytebuffer-rb/
81
113
  post_install_message:
82
114
  rdoc_options: []
83
115
  require_paths:
data/ext/Makefile DELETED
@@ -1,57 +0,0 @@
1
- ifeq '$(findstring ;,$(PATH))' ';'
2
- OS := Windows
3
- else
4
- OS := $(shell uname 2>/dev/null || echo Unknown)
5
- OS := $(patsubst CYGWIN%,Cygwin,$(OS))
6
- OS := $(patsubst MSYS%,MSYS,$(OS))
7
- OS := $(patsubst MINGW%,MSYS,$(OS))
8
- endif
9
-
10
-
11
- ifeq ($(OS),Windows)
12
- SUFFIX := dll
13
- TARGET := x86_64-pc-windows-msvc
14
- endif
15
- ifeq ($(OS),Darwin)
16
- SUFFIX := dylib
17
- TARGET := aarch64-apple-darwin
18
- endif
19
- ifeq ($(OS),Linux)
20
- SUFFIX := so
21
- TARGET := x86_64-unknown-linux-gnu
22
- endif
23
- ifeq ($(OS),GNU)
24
- SUFFIX := so
25
- TARGET := x86_64-unknown-linux-gnu
26
- endif
27
-
28
-
29
- all:
30
- mkdir build
31
- echo "Outputting to $PWD /build/$(TARGET)"
32
- cargo build --release --target=$(TARGET) --target-dir=./build
33
-
34
- clean:
35
- rm -rf target
36
-
37
- install:
38
- cp target/$(TARGET)/release/libext.$(SUFFIX) ./
39
-
40
- test:
41
- cargo test
42
-
43
- build-macos-amd64:
44
- cargo build --release --target=x86_64-apple-darwin
45
- cp target/x86_64-apple-darwin/release/libext.dylib ./
46
-
47
- build-macos-aarch:
48
- cargo build --release --target=aarch64-apple-darwin
49
- cp target/aarch64-apple-darwin/release/libext.dylib ./
50
-
51
- build-linux:
52
- cargo build --release --target=x86_64-unknown-linux-gnu
53
- cp target/x86_64-unknown-linux-gnu/release/libext.so ./
54
-
55
- build-windows:
56
- cargo build --release --target=x86_64-pc-windows-msvc
57
- cp target/x86_64-pc-windows-msvc/release/libext.dll ./
data/ext/extconf.rb DELETED
@@ -1 +0,0 @@
1
- raise 'Install Rust with Cargo from https://www.rust-lang.org/ before installing this gem.' if !system('cargo --version') || !system('rustc --version')
File without changes