@@ -7,11 +7,6 @@ class WasiVfsProduct < BuildProduct
77 def initialize ( build_dir )
88 @build_dir = build_dir
99 @need_fetch_lib = ENV [ "LIB_WASI_VFS_A" ] . nil?
10- installed_cli_path =
11- ENV [ "WASI_VFS_CLI" ] || Toolchain . find_path ( "wasi-vfs" )
12- @need_fetch_cli = installed_cli_path . nil?
13- @cli_path =
14- installed_cli_path || File . join ( cli_product_build_dir , "wasi-vfs" )
1510 end
1611
1712 def lib_product_build_dir
@@ -26,18 +21,6 @@ def lib_wasi_vfs_a
2621 ENV [ "LIB_WASI_VFS_A" ] || File . join ( lib_product_build_dir , "libwasi_vfs.a" )
2722 end
2823
29- def cli_product_build_dir
30- File . join (
31- @build_dir ,
32- RbConfig ::CONFIG [ "host" ] ,
33- "wasi-vfs-#{ WASI_VFS_VERSION } "
34- )
35- end
36-
37- def cli_bin_path
38- @cli_path
39- end
40-
4124 def name
4225 "wasi-vfs-#{ WASI_VFS_VERSION } -#{ RbConfig ::CONFIG [ "host" ] } "
4326 end
@@ -58,26 +41,5 @@ def build(executor)
5841 executor . mv File . join ( tmpdir , "libwasi_vfs.a" ) , lib_wasi_vfs_a
5942 end
6043 end
61-
62- def install_cli
63- return if !@need_fetch_cli || File . exist? ( cli_bin_path )
64- FileUtils . mkdir_p cli_product_build_dir
65- zipfile = File . join ( cli_product_build_dir , "wasi-vfs-cli.zip" )
66- system "curl" , "-L" , "-o" , zipfile , self . cli_download_url
67- system "unzip" , zipfile , "-d" , cli_product_build_dir
68- end
69-
70- def cli_download_url
71- assets = [
72- [ /x86_64-linux/ , "wasi-vfs-cli-x86_64-unknown-linux-gnu.zip" ] ,
73- [ /x86_64-darwin/ , "wasi-vfs-cli-x86_64-apple-darwin.zip" ] ,
74- [ /arm64e?-darwin/ , "wasi-vfs-cli-aarch64-apple-darwin.zip" ]
75- ]
76- asset = assets . find { |os , _ | os =~ RUBY_PLATFORM } &.at ( 1 )
77- if asset . nil?
78- raise "unsupported platform for fetching wasi-vfs CLI: #{ RUBY_PLATFORM } "
79- end
80- "https://github.com/kateinoigakukun/wasi-vfs/releases/download/v#{ WASI_VFS_VERSION } /#{ asset } "
81- end
8244 end
8345end
0 commit comments