Skip to content

Commit 3101d02

Browse files
Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 in the build system
WASI community is going to be introducing pN suffix to the target triples to distinguish the different versions of the WASI Preview versions (e.g. `wasm32-unknown-wasip1` for WASI Preview1) to prepare the upcoming WASI Preview2 and so on. Other projects are also following this change: * WebAssembly/wasi-libc#478 * rust-lang/compiler-team#607
1 parent 3bfe810 commit 3101d02

File tree

11 files changed

+28
-28
lines changed

11 files changed

+28
-28
lines changed

CONTRIBUTING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ rake --tasks
2121
$ rake build:download_prebuilt
2222

2323
# Build Ruby (if you need to build Ruby by yourself)
24-
$ rake build:head-wasm32-unknown-wasi-full
24+
$ rake build:head-wasm32-unknown-wasip1-full
2525

2626
# Build npm package
2727
$ rake npm:ruby-head-wasm-wasi
@@ -48,15 +48,15 @@ To select a build profile, see [profiles section in README](https://github.com/r
4848

4949
```console
5050
# Build only a specific combination of ruby version, profile, and target
51-
$ rake build:head-wasm32-unknown-wasi-full
51+
$ rake build:head-wasm32-unknown-wasip1-full
5252
# Clean up the build directory
53-
$ rake build:head-wasm32-unknown-wasi-full:clean
53+
$ rake build:head-wasm32-unknown-wasip1-full:clean
5454
# Force to re-execute "make install"
55-
$ rake build:head-wasm32-unknown-wasi-full:remake
55+
$ rake build:head-wasm32-unknown-wasip1-full:remake
5656

5757
# Output is in the `rubies` directory
58-
$ tree -L 3 rubies/head-wasm32-unknown-wasi-full
59-
rubies/head-wasm32-unknown-wasi-full/
58+
$ tree -L 3 rubies/head-wasm32-unknown-wasip1-full
59+
rubies/head-wasm32-unknown-wasip1-full/
6060
├── usr
6161
│   └── local
6262
│   ├── bin

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ Dependencies: [wasmtime](https://github.com/bytecodealliance/wasmtime)
4040
```console
4141
$ gem install ruby_wasm
4242
# Download a prebuilt Ruby release
43-
$ curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3.3-wasm32-unknown-wasi-full.tar.gz
44-
$ tar xfz ruby-3.3-wasm32-unknown-wasi-full.tar.gz
43+
$ curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3.3-wasm32-unknown-wasip1-full.tar.gz
44+
$ tar xfz ruby-3.3-wasm32-unknown-wasip1-full.tar.gz
4545

4646
# Extract ruby binary not to pack itself
47-
$ mv ruby-3.3-wasm32-unknown-wasi-full/usr/local/bin/ruby ruby.wasm
47+
$ mv ruby-3.3-wasm32-unknown-wasip1-full/usr/local/bin/ruby ruby.wasm
4848

4949
# Put your app code
5050
$ mkdir src
5151
$ echo "puts 'Hello'" > src/my_app.rb
5252

5353
# Pack the whole directory under /usr and your app dir
54-
$ rbwasm pack ruby.wasm --dir ./src::/src --dir ./ruby-3.3-wasm32-unknown-wasi-full/usr::/usr -o my-ruby-app.wasm
54+
$ rbwasm pack ruby.wasm --dir ./src::/src --dir ./ruby-3.3-wasm32-unknown-wasip1-full/usr::/usr -o my-ruby-app.wasm
5555

5656
# Run the packed scripts
5757
$ wasmtime my-ruby-app.wasm /src/my_app.rb
@@ -110,8 +110,8 @@ A _build_ is a combination of ruby version, _profile_, and _target_.
110110
</thead>
111111
<tbody>
112112
<tr>
113-
<td><code>wasm32-unknown-wasi</code></td>
114-
<td>Targeting WASI-compatible environments (e.g. Node.js, browsers with polyfill, <a href="https://github.com/bytecodealliance/wasmtime">wasmtime</a>, and so on)</td>
113+
<td><code>wasm32-unknown-wasip1</code></td>
114+
<td>Targeting [WASI Preview1](https://github.com/WebAssembly/WASI/tree/main/legacy/preview1)-compatible environments (e.g. Node.js, browsers with polyfill, <a href="https://github.com/bytecodealliance/wasmtime">wasmtime</a>, and so on)</td>
115115
</tr>
116116
<tr>
117117
<td><code>wasm32-unknown-emscripten</code></td>

Rakefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ BUILD_PROFILES = %w[full minimal]
1515
BUILDS =
1616
BUILD_SOURCES
1717
.product(BUILD_PROFILES)
18-
.map { |src, profile| [src, "wasm32-unknown-wasi", profile] } +
18+
.map { |src, profile| [src, "wasm32-unknown-wasip1", profile] } +
1919
BUILD_SOURCES.map { |src| [src, "wasm32-unknown-emscripten", "full"] }
2020

2121
NPM_PACKAGES = [
@@ -29,26 +29,26 @@ NPM_PACKAGES = [
2929
name: "ruby-head-wasm-wasi",
3030
ruby_version: "head",
3131
gemfile: "packages/npm-packages/ruby-wasm-wasi/Gemfile",
32-
target: "wasm32-unknown-wasi"
32+
target: "wasm32-unknown-wasip1"
3333
},
3434
{
3535
name: "ruby-3.3-wasm-wasi",
3636
ruby_version: "3.3",
3737
gemfile: "packages/npm-packages/ruby-wasm-wasi/Gemfile",
38-
target: "wasm32-unknown-wasi"
38+
target: "wasm32-unknown-wasip1"
3939
},
4040
{
4141
name: "ruby-3.2-wasm-wasi",
4242
ruby_version: "3.2",
4343
gemfile: "packages/npm-packages/ruby-wasm-wasi/Gemfile",
44-
target: "wasm32-unknown-wasi"
44+
target: "wasm32-unknown-wasip1"
4545
},
46-
{ name: "ruby-wasm-wasi", target: "wasm32-unknown-wasi" }
46+
{ name: "ruby-wasm-wasi", target: "wasm32-unknown-wasip1" }
4747
]
4848

4949
STANDALONE_PACKAGES = [
50-
{ name: "ruby", build: "head-wasm32-unknown-wasi-full" },
51-
{ name: "irb", build: "head-wasm32-unknown-wasi-full" }
50+
{ name: "ruby", build: "head-wasm32-unknown-wasip1-full" },
51+
{ name: "irb", build: "head-wasm32-unknown-wasip1-full" }
5252
]
5353

5454
LIB_ROOT = File.dirname(__FILE__)

lib/ruby_wasm/build/product/crossruby.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def configure_args(build_triple, toolchain)
293293
args << %Q(--with-baseruby=#{baseruby_path})
294294

295295
case target
296-
when "wasm32-unknown-wasi"
296+
when /^wasm32-unknown-wasi/
297297
xldflags << @wasi_vfs.lib_wasi_vfs_a if @wasi_vfs
298298
# TODO: Find a way to force cast or update API
299299
# @type var wasi_sdk_path: untyped

lib/ruby_wasm/build/product/openssl.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def configure_args
4242
--libdir=lib
4343
-Wl,--allow-undefined
4444
]
45-
if @target.triple == "wasm32-unknown-wasi"
45+
if @target.triple.start_with?("wasm32-unknown-wasi")
4646
args.concat %w[
4747
-D_WASI_EMULATED_SIGNAL
4848
-D_WASI_EMULATED_PROCESS_CLOCKS

lib/ruby_wasm/build/product/product.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def initialize(target, toolchain)
1313
def system_triplet_args
1414
args = []
1515
case @target.triple
16-
when "wasm32-unknown-wasi"
16+
when /^wasm32-unknown-wasi/
1717
args.concat(%W[--host wasm32-wasi])
1818
when "wasm32-unknown-emscripten"
1919
args.concat(%W[--host wasm32-emscripten])

lib/ruby_wasm/build/product/wasi_vfs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def initialize(build_dir)
1212
def lib_product_build_dir
1313
File.join(
1414
@build_dir,
15-
"wasm32-unknown-wasi",
15+
"wasm32-unknown-wasip1",
1616
"wasi-vfs-#{WASI_VFS_VERSION}"
1717
)
1818
end

lib/ruby_wasm/build/toolchain.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def check_envvar(name)
1818

1919
def self.get(target, build_dir = nil)
2020
case target
21-
when "wasm32-unknown-wasi"
21+
when /^wasm32-unknown-wasi/
2222
return RubyWasm::WASISDK.new(build_dir: build_dir)
2323
when "wasm32-unknown-emscripten"
2424
return RubyWasm::Emscripten.new

lib/ruby_wasm/cli.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def build(args)
5050
reconfigure: false,
5151
clean: false,
5252
ruby_version: "3.3",
53-
target_triplet: "wasm32-unknown-wasi",
53+
target_triplet: "wasm32-unknown-wasip1",
5454
profile: "full",
5555
stdlib: true,
5656
disable_gems: false,

lib/ruby_wasm/packager.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def package(executor, dest_dir, options)
3535
fs.remove_non_runtime_files(executor)
3636
fs.remove_stdlib(executor) unless options[:stdlib]
3737

38-
if full_build_options[:target] == "wasm32-unknown-wasi" && !support_dynamic_linking?
38+
if full_build_options[:target] == "wasm32-unknown-wasip1" && !support_dynamic_linking?
3939
# wasi-vfs supports only WASI target
4040
wasi_vfs = RubyWasmExt::WasiVfs.new
4141
wasi_vfs.map_dir("/bundle", fs.bundle_dir)
@@ -72,7 +72,7 @@ def support_dynamic_linking?
7272
# Retrieves the build options used for building Ruby itself.
7373
def build_options
7474
default = {
75-
target: RubyWasm::Target.new("wasm32-unknown-wasi"),
75+
target: RubyWasm::Target.new("wasm32-unknown-wasip1"),
7676
default_exts: ALL_DEFAULT_EXTS
7777
}
7878
override = @config || {}

rakelib/packaging.rake

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace :npm do
6161
end
6262
dist_dir = File.join(pkg_dir, "dist")
6363
mkdir_p dist_dir
64-
if pkg[:target] == "wasm32-unknown-wasi"
64+
if pkg[:target].start_with?("wasm32-unknown-wasi")
6565
Dir.chdir(cwd || base_dir) do
6666
sh env,
6767
*build_command,

0 commit comments

Comments
 (0)