|
| 1 | +module RubyWasm |
| 2 | + VERSION: String |
| 3 | + |
| 4 | + class BuildParams |
| 5 | + attr_accessor name: String |
| 6 | + attr_accessor target: String |
| 7 | + attr_accessor default_exts: String |
| 8 | + end |
| 9 | + |
| 10 | + class BuildProduct |
| 11 | + def name: -> String |
| 12 | + end |
| 13 | + |
| 14 | + class AutoconfProduct < BuildProduct |
| 15 | + @target: String |
| 16 | + @toolchain: Toolchain |
| 17 | + |
| 18 | + def initialize: (String target, Toolchain toolchain) -> void |
| 19 | + def system_triplet_args: -> Array[String] |
| 20 | + | -> Array[String] |
| 21 | + def tools_args: -> Array[String] |
| 22 | + | -> Array[String] |
| 23 | + def configure_args: -> Array[String] |
| 24 | + | -> Array[String] |
| 25 | + end |
| 26 | + |
| 27 | + class BuildSource < BuildProduct |
| 28 | + @params: Hash[untyped, untyped] |
| 29 | + @build_dir: String |
| 30 | + |
| 31 | + def initialize: (untyped params, String build_dir) -> void |
| 32 | + def name: -> String |
| 33 | + def cache_key: (Digest::SHA256 digest) -> void |
| 34 | + def src_dir: -> String |
| 35 | + def configure_file: -> String |
| 36 | + def fetch: (BuildExecutor executor) -> void |
| 37 | + def build: (BuildExecutor executor) -> void |
| 38 | + end |
| 39 | + |
| 40 | + class BaseRubyProduct < BuildProduct |
| 41 | + @build_dir: String |
| 42 | + @source: BuildSource |
| 43 | + @channel: String |
| 44 | + |
| 45 | + def initialize: (String build_dir, BuildSource source) -> void |
| 46 | + def product_build_dir: -> String |
| 47 | + def install_dir: -> String |
| 48 | + def name: -> String |
| 49 | + def build: (BuildExecutor executor) -> void |
| 50 | + end |
| 51 | + |
| 52 | + class ZlibProduct < AutoconfProduct |
| 53 | + ZLIB_VERSION: String |
| 54 | + @build_dir: String |
| 55 | + |
| 56 | + attr_reader target: String |
| 57 | + def initialize: (String build_dir, String target, Toolchain toolchain) -> void |
| 58 | + def product_build_dir: -> String |
| 59 | + def destdir: -> String |
| 60 | + def install_root: -> String |
| 61 | + def name: -> String |
| 62 | + def configure_args: -> Array[String] |
| 63 | + def build: (BuildExecutor executor) -> void |
| 64 | + end |
| 65 | + |
| 66 | + class LibYAMLProduct < AutoconfProduct |
| 67 | + LIBYAML_VERSION: String |
| 68 | + @build_dir: String |
| 69 | + |
| 70 | + attr_reader target: String |
| 71 | + def initialize: (String build_dir, String target, Toolchain toolchain) -> void |
| 72 | + def product_build_dir: -> String |
| 73 | + def destdir: -> String |
| 74 | + def install_root: -> String |
| 75 | + def name: -> String |
| 76 | + def build: (BuildExecutor executor) -> void |
| 77 | + end |
| 78 | + |
| 79 | + class OpenSSLProduct < AutoconfProduct |
| 80 | + OPENSSL_VERSION: String |
| 81 | + @build_dir: String |
| 82 | + |
| 83 | + attr_reader target: String |
| 84 | + def initialize: (String build_dir, String target, Toolchain toolchain) -> void |
| 85 | + def product_build_dir: -> String |
| 86 | + def destdir: -> String |
| 87 | + def install_root: -> String |
| 88 | + def name: -> String |
| 89 | + def configure_args: -> Array[String] |
| 90 | + def build: (BuildExecutor executor) -> void |
| 91 | + end |
| 92 | + |
| 93 | + class WasiVfsProduct < BuildProduct |
| 94 | + WASI_VFS_VERSION: String |
| 95 | + @build_dir: String |
| 96 | + @need_fetch_lib: bool |
| 97 | + @cli_path: String |
| 98 | + @need_fetch_cli: bool |
| 99 | + |
| 100 | + def initialize: (String build_dir) -> void |
| 101 | + def lib_product_build_dir: -> String |
| 102 | + def lib_wasi_vfs_a: -> String |
| 103 | + def cli_product_build_dir: -> String |
| 104 | + def cli_bin_path: -> String |
| 105 | + def name: -> String |
| 106 | + def build: (BuildExecutor executor) -> void |
| 107 | + def install_cli: -> bool? |
| 108 | + def cli_download_url: -> String |
| 109 | + end |
| 110 | + |
| 111 | + class CrossRubyExtProduct < BuildProduct |
| 112 | + @toolchain: Toolchain |
| 113 | + @srcdir: String |
| 114 | + |
| 115 | + attr_reader name: String |
| 116 | + def initialize: (String srcdir, Toolchain toolchain, ?name: nil) -> void |
| 117 | + def product_build_dir: (CrossRubyProduct crossruby) -> String |
| 118 | + def linklist: (CrossRubyProduct crossruby) -> String |
| 119 | + def make_args: (CrossRubyProduct crossruby) -> Array[String] |
| 120 | + def build: (BuildExecutor executor, CrossRubyProduct crossruby) -> void |
| 121 | + def do_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void |
| 122 | + def do_install_rb: (BuildExecutor executor, CrossRubyProduct crossruby) -> void |
| 123 | + def cache_key: (Digest::SHA256 digest) -> void |
| 124 | + end |
| 125 | + |
| 126 | + class CrossRubyProduct < AutoconfProduct |
| 127 | + @params: BuildParams |
| 128 | + @rubies_dir: String |
| 129 | + @build_dir: String |
| 130 | + @baseruby: BaseRubyProduct |
| 131 | + @libyaml: LibYAMLProduct |
| 132 | + @zlib: ZlibProduct |
| 133 | + @openssl: OpenSSLProduct |
| 134 | + @wasi_vfs: WasiVfsProduct |
| 135 | + |
| 136 | + attr_reader source: BuildSource |
| 137 | + attr_reader toolchain: Toolchain |
| 138 | + attr_accessor user_exts: Array[CrossRubyExtProduct] |
| 139 | + attr_accessor wasmoptflags: Array[String] |
| 140 | + attr_accessor cppflags: Array[String] |
| 141 | + attr_accessor cflags: Array[String] |
| 142 | + attr_accessor ldflags: Array[String] |
| 143 | + attr_accessor debugflags: Array[String] |
| 144 | + attr_accessor xcflags: Array[String] |
| 145 | + attr_accessor xldflags: Array[String] |
| 146 | + def initialize: (BuildParams params, String build_dir, String rubies_dir, BaseRubyProduct baseruby, BuildSource source, Toolchain toolchain, ?user_exts: Array[CrossRubyExtProduct]) -> void |
| 147 | + def configure: (BuildExecutor executor, ?reconfigure: bool) -> void |
| 148 | + def build_exts: (BuildExecutor executor) -> bool? |
| 149 | + def build: (BuildExecutor executor, ?remake: bool, ?reconfigure: bool) -> bool? |
| 150 | + def clean: (BuildExecutor executor) -> void |
| 151 | + def name: -> String |
| 152 | + def cache_key: (Digest::SHA256 digest) -> void |
| 153 | + def build_dir: -> String |
| 154 | + def ext_build_dir: -> String |
| 155 | + def with_libyaml: (LibYAMLProduct libyaml) -> LibYAMLProduct |
| 156 | + def with_zlib: (ZlibProduct zlib) -> ZlibProduct |
| 157 | + def with_wasi_vfs: (WasiVfsProduct wasi_vfs) -> WasiVfsProduct |
| 158 | + def with_openssl: (OpenSSLProduct openssl) -> OpenSSLProduct |
| 159 | + def dest_dir: -> String |
| 160 | + def artifact: -> String |
| 161 | + def extinit_obj: -> String |
| 162 | + def extinit_c_erb: -> String |
| 163 | + def baseruby_path: -> String |
| 164 | + def configure_args: (String build_triple, Toolchain toolchain) -> Array[String] |
| 165 | + end |
| 166 | + |
| 167 | + class WitBindgen |
| 168 | + @build_dir: String |
| 169 | + @tool_dir: String |
| 170 | + @revision: String |
| 171 | + |
| 172 | + attr_reader bin_path: String |
| 173 | + def initialize: (build_dir: String, ?revision: String) -> void |
| 174 | + def install: -> void |
| 175 | + end |
| 176 | + |
| 177 | + class Toolchain |
| 178 | + @tools: Hash[untyped, untyped] |
| 179 | + @tools_cache: Hash[untyped, untyped] |
| 180 | + |
| 181 | + attr_reader name: String |
| 182 | + def initialize: -> void |
| 183 | + def find_tool: (Symbol name) -> bot |
| 184 | + def check_envvar: (untyped name) -> nil |
| 185 | + def self.get: (String target, ?String? build_dir) -> (Toolchain) |
| 186 | + def self.find_path: (String command) -> String? |
| 187 | + def self.check_executable: (String command) -> String |
| 188 | + def cc: -> nil |
| 189 | + def ranlib: -> nil |
| 190 | + def ld: -> nil |
| 191 | + def ar: -> nil |
| 192 | + |
| 193 | + def install: -> void |
| 194 | + end |
| 195 | + |
| 196 | + class WASISDK < Toolchain |
| 197 | + @wasm_opt_path: String |
| 198 | + @need_fetch_wasi_sdk: bool |
| 199 | + @need_fetch_binaryen: bool |
| 200 | + @tools: Hash[Symbol, String] |
| 201 | + @wasi_sdk_path: String |
| 202 | + @binaryen_version: Integer |
| 203 | + @version_major: Integer |
| 204 | + @version_minor: Integer |
| 205 | + @binaryen_path: String |
| 206 | + |
| 207 | + def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version_major: Integer, ?version_minor: Integer, ?binaryen_version: Integer) -> void |
| 208 | + def find_tool: (Symbol name) -> String |
| 209 | + def wasm_opt: -> String |
| 210 | + def wasi_sdk_path: -> String |
| 211 | + def download_url: (Integer? version_major, Integer? version_minor) -> String |
| 212 | + def binaryen_download_url: (Integer? version) -> String |
| 213 | + def install_wasi_sdk: -> void |
| 214 | + def install_binaryen: -> void |
| 215 | + end |
| 216 | + |
| 217 | + class Emscripten < Toolchain |
| 218 | + @tools: Hash[Symbol, String] |
| 219 | + |
| 220 | + def initialize: -> void |
| 221 | + def find_tool: (Symbol name) -> String |
| 222 | + end |
| 223 | + |
| 224 | + class BuildExecutor |
| 225 | + def system: (*untyped, **untyped) -> bool? |
| 226 | + def rm_rf: (FileUtils::pathlist list) -> void |
| 227 | + def rm_f: (FileUtils::pathlist list) -> void |
| 228 | + def cp_r: (FileUtils::pathlist src, path dest) -> void |
| 229 | + def mv: (FileUtils::pathlist src, path dest) -> void |
| 230 | + def mkdir_p: (FileUtils::pathlist list) -> void |
| 231 | + def write: (String path, _ToS data) -> void |
| 232 | + end |
| 233 | + |
| 234 | + class Downloader |
| 235 | + def format_size: (Integer size) -> String |
| 236 | + |
| 237 | + def download: (String url, String dest, String message) -> void |
| 238 | + end |
| 239 | + |
| 240 | + class BuildTask |
| 241 | + @build_dir: String |
| 242 | + @rubies_dir: String |
| 243 | + @openssl: OpenSSLProduct |
| 244 | + |
| 245 | + attr_accessor name: String |
| 246 | + attr_reader source: BuildSource |
| 247 | + attr_reader target: String |
| 248 | + attr_reader toolchain: Toolchain |
| 249 | + attr_reader libyaml: LibYAMLProduct |
| 250 | + attr_reader zlib: ZlibProduct |
| 251 | + attr_reader wasi_vfs: WasiVfsProduct |
| 252 | + attr_reader baseruby: BaseRubyProduct |
| 253 | + attr_reader crossruby: CrossRubyProduct |
| 254 | + def initialize: (String name, target: String, src: untyped, ?toolchain: Toolchain?, ?build_dir: String?, ?rubies_dir: String?, **untyped) -> void |
| 255 | + def hexdigest: -> String |
| 256 | + end |
| 257 | +end |
0 commit comments