ruby_wasm 2.5.0-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.clang-format +8 -0
- data/CONTRIBUTING.md +126 -0
- data/Gemfile +17 -0
- data/LICENSE +21 -0
- data/NOTICE +1293 -0
- data/README.md +153 -0
- data/Rakefile +163 -0
- data/Steepfile +24 -0
- data/benchmarks/vm_deep_call.rb +55 -0
- data/builders/wasm32-unknown-emscripten/Dockerfile +43 -0
- data/builders/wasm32-unknown-emscripten/entrypoint.sh +7 -0
- data/builders/wasm32-unknown-wasi/Dockerfile +47 -0
- data/builders/wasm32-unknown-wasi/entrypoint.sh +7 -0
- data/docs/api.md +2 -0
- data/docs/cheat_sheet.md +195 -0
- data/docs/faq.md +25 -0
- data/exe/rbwasm +7 -0
- data/ext/.gitignore +2 -0
- data/ext/README.md +11 -0
- data/ext/extinit.c.erb +32 -0
- data/lib/ruby_wasm/3.0/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.1/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.2/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/build/build_params.rb +3 -0
- data/lib/ruby_wasm/build/downloader.rb +18 -0
- data/lib/ruby_wasm/build/executor.rb +187 -0
- data/lib/ruby_wasm/build/product/baseruby.rb +37 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +330 -0
- data/lib/ruby_wasm/build/product/libyaml.rb +68 -0
- data/lib/ruby_wasm/build/product/openssl.rb +88 -0
- data/lib/ruby_wasm/build/product/product.rb +39 -0
- data/lib/ruby_wasm/build/product/ruby_source.rb +103 -0
- data/lib/ruby_wasm/build/product/wasi_vfs.rb +45 -0
- data/lib/ruby_wasm/build/product/zlib.rb +68 -0
- data/lib/ruby_wasm/build/product.rb +8 -0
- data/lib/ruby_wasm/build/toolchain/wit_bindgen.rb +31 -0
- data/lib/ruby_wasm/build/toolchain.rb +193 -0
- data/lib/ruby_wasm/build.rb +88 -0
- data/lib/ruby_wasm/cli.rb +217 -0
- data/lib/ruby_wasm/packager/core.rb +156 -0
- data/lib/ruby_wasm/packager/file_system.rb +158 -0
- data/lib/ruby_wasm/packager.rb +159 -0
- data/lib/ruby_wasm/rake_task.rb +59 -0
- data/lib/ruby_wasm/util.rb +15 -0
- data/lib/ruby_wasm/version.rb +3 -0
- data/lib/ruby_wasm.rb +33 -0
- data/package-lock.json +9500 -0
- data/package.json +12 -0
- data/rakelib/check.rake +37 -0
- data/rakelib/ci.rake +152 -0
- data/rakelib/doc.rake +29 -0
- data/rakelib/format.rake +35 -0
- data/rakelib/gem.rake +22 -0
- data/rakelib/packaging.rake +151 -0
- data/rakelib/version.rake +40 -0
- data/sig/open_uri.rbs +4 -0
- data/sig/ruby_wasm/build.rbs +318 -0
- data/sig/ruby_wasm/cli.rbs +27 -0
- data/sig/ruby_wasm/ext.rbs +13 -0
- data/sig/ruby_wasm/packager.rbs +91 -0
- data/sig/ruby_wasm/util.rbs +5 -0
- data/tools/clang-format-diff.sh +18 -0
- data/tools/exe/rbminify +12 -0
- data/tools/lib/syntax_tree/minify_ruby.rb +63 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3d02eff98e66ede50a76cef3623903cccea6648899d132b26e127c41ce203c59
|
4
|
+
data.tar.gz: 4b89357b5e4332e7a4c70f2e87dd894fdc0a35c366c1d0f9d230aebf5570d017
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e5824e91592ebe123811048479c61b5f80544bf3acf6e18ed5d629804682b83e5c813591eb493289cd9b86f00ea7bab27d93a3557c9a1c18eadd7989b186a39f
|
7
|
+
data.tar.gz: 7d0094d881ef2aa5e9219c1a2b806d08b8d0d43d86fd6c33af8295247c7e4ccf177c63a5eb5c968be08f62359e89354d165eaf2c8ea030c1da5d97c1d94eb7f3
|
data/.clang-format
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
Thank you for your interest in contributing to ruby.wasm!
|
4
|
+
This document describes development setup and pointers for diving into this project.
|
5
|
+
|
6
|
+
## Install dependencies
|
7
|
+
|
8
|
+
```console
|
9
|
+
$ git clone https://github.com/ruby/ruby.wasm
|
10
|
+
$ cd ruby.wasm
|
11
|
+
$ ./bin/setup
|
12
|
+
# Compile extension library
|
13
|
+
$ bundle exec rake compile
|
14
|
+
$ rake --tasks
|
15
|
+
```
|
16
|
+
|
17
|
+
## Building and Testing [`ruby-wasm-wasi`](./packages/npm-packages/ruby-wasm-wasi)
|
18
|
+
|
19
|
+
```console
|
20
|
+
# Download a prebuilt Ruby release (if you don't need to re-build Ruby)
|
21
|
+
$ rake build:download_prebuilt
|
22
|
+
|
23
|
+
# Build Ruby (if you need to build Ruby by yourself)
|
24
|
+
$ rake build:head-wasm32-unknown-wasi-full
|
25
|
+
|
26
|
+
# Build npm package
|
27
|
+
$ rake npm:ruby-head-wasm-wasi
|
28
|
+
# Test npm package
|
29
|
+
$ rake npm:ruby-head-wasm-wasi:check
|
30
|
+
```
|
31
|
+
|
32
|
+
If you need to re-build Ruby, please clean `./rubies` directory, and run `rake npm:ruby-head-wasm-wasi` again.
|
33
|
+
|
34
|
+
## Building CRuby from source
|
35
|
+
|
36
|
+
If you want to build CRuby for WebAssembly from source yourself, follow the below instructions.
|
37
|
+
|
38
|
+
> **Warning**
|
39
|
+
> If you just want to build npm packages, you don't need to build CRuby from source.
|
40
|
+
> You can download a prebuilt Ruby release by `rake build:download_prebuilt`.
|
41
|
+
|
42
|
+
### For WASI target
|
43
|
+
|
44
|
+
You can build CRuby for WebAssembly/WASI on Linux (x86_64) or macOS (x86_64, arm64).
|
45
|
+
For WASI target, dependencies are automatically downloaded on demand, so you don't need to install them manually.
|
46
|
+
|
47
|
+
To select a build profile, see [profiles section in README](https://github.com/ruby/ruby.wasm#profiles).
|
48
|
+
|
49
|
+
```console
|
50
|
+
# Build only a specific combination of ruby version, profile, and target
|
51
|
+
$ rake build:head-wasm32-unknown-wasi-full
|
52
|
+
# Clean up the build directory
|
53
|
+
$ rake build:head-wasm32-unknown-wasi-full:clean
|
54
|
+
# Force to re-execute "make install"
|
55
|
+
$ rake build:head-wasm32-unknown-wasi-full:remake
|
56
|
+
|
57
|
+
# Output is in the `rubies` directory
|
58
|
+
$ tree -L 3 rubies/head-wasm32-unknown-wasi-full
|
59
|
+
rubies/head-wasm32-unknown-wasi-full/
|
60
|
+
├── usr
|
61
|
+
│ └── local
|
62
|
+
│ ├── bin
|
63
|
+
│ ├── include
|
64
|
+
│ ├── lib
|
65
|
+
│ └── share
|
66
|
+
```
|
67
|
+
|
68
|
+
### For Emscripten target
|
69
|
+
|
70
|
+
To build CRuby for WebAssembly/Emscripten, you need to install [Emscripten](https://emscripten.org).
|
71
|
+
Please follow the official instructions to install.
|
72
|
+
|
73
|
+
```console
|
74
|
+
# Build only a specific combination of ruby version, profile, and target
|
75
|
+
$ rake build:head-wasm32-unknown-emscripten-full
|
76
|
+
# Output is in the `rubies` directory
|
77
|
+
$ tree -L 3 rubies/head-wasm32-unknown-emscripten-full
|
78
|
+
rubies/head-wasm32-unknown-emscripten-full
|
79
|
+
└── usr
|
80
|
+
└── local
|
81
|
+
├── bin
|
82
|
+
├── include
|
83
|
+
├── lib
|
84
|
+
└── share
|
85
|
+
```
|
86
|
+
|
87
|
+
## Code Formatting
|
88
|
+
|
89
|
+
This project uses multiple code formatters for each language.
|
90
|
+
To format all files, run `rake format`.
|
91
|
+
Please make sure to run this command before submitting a pull request.
|
92
|
+
|
93
|
+
## Re-bindgen from `.wit` files
|
94
|
+
|
95
|
+
If you update [`*.wit`](https://github.com/WebAssembly/component-model/blob/ed90add27ae845b2e2b9d7db38a966d9f78aa4c0/design/mvp/WIT.md), which describe the interface of a WebAssembly module, either imported or exported, you need to re-generate glue code from `*.wit`.
|
96
|
+
|
97
|
+
To re-generate them, you need to install the Rust compiler `rustc` and Cargo, then run `rake check:bindgen`.
|
98
|
+
|
99
|
+
The rake task installs [`wit-bindgen`](https://github.com/bytecodealliance/wit-bindgen) on demand, then just execute it for each generated code
|
100
|
+
|
101
|
+
If you see `missing executable: cargo`, please make sure `cargo` is installed correctly in your `PATH`.
|
102
|
+
|
103
|
+
## Release Process
|
104
|
+
|
105
|
+
To bump up npm package version, please follow the below steps:
|
106
|
+
|
107
|
+
```
|
108
|
+
$ rake 'bump_version[0.6.0]'
|
109
|
+
$ git commit -m"Bump version to 0.6.0"
|
110
|
+
$ git tag 0.6.0
|
111
|
+
$ git push origin 0.6.0
|
112
|
+
```
|
113
|
+
|
114
|
+
## Release Channels
|
115
|
+
|
116
|
+
Each npm package in this project provides two release channels: `latest` and `next`. The `latest` channel is for stable releases, and `next` channel is for pre-release.
|
117
|
+
|
118
|
+
e.g. For [`@ruby/wasm-wasi`](https://www.npmjs.com/package/@ruby/wasm-wasi)
|
119
|
+
|
120
|
+
```console
|
121
|
+
$ npm install --save @ruby/wasm-wasi@latest
|
122
|
+
# or if you want the nightly snapshot
|
123
|
+
$ npm install --save @ruby/wasm-wasi@next
|
124
|
+
# or you can specify the exact snapshot version
|
125
|
+
$ npm install --save @ruby/wasm-wasi@2.5.0-2024-01-28-a
|
126
|
+
```
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "rake"
|
9
|
+
gem "rake-compiler"
|
10
|
+
gem "rb_sys", "0.9.85"
|
11
|
+
end
|
12
|
+
|
13
|
+
group :check do
|
14
|
+
gem "webrick"
|
15
|
+
gem "syntax_tree", "~> 3.5"
|
16
|
+
gem "steep"
|
17
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Yuta Saito
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|