From 4e9b983bad91acdc651cf7c518a118e27598f1e1 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:39:15 +0800 Subject: [PATCH] wasi-runtimes 19.1.3 Also: - avoid referencing LLVM cellar paths in symlinks - fix some build flags --- Formula/w/wasi-runtimes.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Formula/w/wasi-runtimes.rb b/Formula/w/wasi-runtimes.rb index 069778258ef3..242e21a957ca 100644 --- a/Formula/w/wasi-runtimes.rb +++ b/Formula/w/wasi-runtimes.rb @@ -1,8 +1,8 @@ class WasiRuntimes < Formula desc "Compiler-RT and libc++ runtimes for WASI" homepage "https://wasi.dev" - url "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/llvm-project-19.1.2.src.tar.xz" - sha256 "3666f01fc52d8a0b0da83e107d74f208f001717824be0b80007f529453aa1e19" + url "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/llvm-project-19.1.3.src.tar.xz" + sha256 "324d483ff0b714c8ce7819a1b679dd9e4706cf91c6caf7336dc4ac0c1d3bf636" license "Apache-2.0" => { with: "LLVM-exception" } head "https://github.com/llvm/llvm-project.git", branch: "main" @@ -53,6 +53,9 @@ def install -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_SYSROOT=#{wasi_libc.opt_share}/wasi-sysroot + -DCMAKE_FIND_FRAMEWORK=NEVER + -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=#{HOMEBREW_LIBRARY_PATH}/cmake/trap_fetchcontent_provider.cmake ] # Compiler flags taken from: # https://github.com/WebAssembly/wasi-sdk/blob/5e04cd81eb749edb5642537d150ab1ab7aedabe9/cmake/wasi-sdk-sysroot.cmake#L65-L75 @@ -75,7 +78,10 @@ def install (pkgshare/"lib").install_symlink "wasi" => "wasip1" (pkgshare/"lib").install_symlink "wasi" => "wasip2" - clang_resource_dir = Pathname.new(Utils.safe_popen_read(llvm.opt_bin/"clang", "-print-resource-dir").chomp) + clang_resource_dir = Utils.safe_popen_read(llvm.opt_bin/"clang", "-print-resource-dir").chomp + clang_resource_dir.sub! llvm.prefix.realpath, llvm.opt_prefix + clang_resource_dir = Pathname.new(clang_resource_dir) + clang_resource_include_dir = clang_resource_dir/"include" clang_resource_include_dir.find do |pn| next unless pn.file? @@ -84,16 +90,22 @@ def install target = pkgshare/relative_path next if target.exist? - target.parent.install_symlink pn + target.parent.mkpath + ln_s pn, target end + # FIXME: the build mistakenly concludes our toolchain doesn't support `-fno-exceptions` + # because we have no `wasm-component-ld`. Remove the line below when + # `wasm-component-ld` is merged. + ENV.append_to_cflags "-fno-exceptions" target_configuration = Hash.new { |h, k| h[k] = {} } targets.each do |target| # Configuration taken from: # https://github.com/WebAssembly/wasi-sdk/blob/5e04cd81eb749edb5642537d150ab1ab7aedabe9/cmake/wasi-sdk-sysroot.cmake#L227-L271 configuration = target_configuration[target] - configuration[:threads] = configuration[:pic] = target.end_with?("-threads") ? "ON" : "OFF" + configuration[:threads] = target.end_with?("-threads") ? "ON" : "OFF" + configuration[:pic] = target.end_with?("-threads") ? "OFF" : "ON" configuration[:flags] = target.end_with?("-threads") ? ["-pthread"] : [] cflags = ENV.cflags&.split || [] @@ -130,7 +142,7 @@ def install -DLIBCXX_ENABLE_FILESYSTEM:BOOL=ON -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL=OFF -DLIBCXX_CXX_ABI=libcxxabi - -DLIBCXX_CXX_ABI_INCLUDE_PATHS=#{testpath}/libcxxabi/include + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=#{buildpath}/libcxxabi/include -DLIBCXX_HAS_MUSL_LIBC:BOOL=ON -DLIBCXX_ABI_VERSION=2 -DLIBCXXABI_ENABLE_EXCEPTIONS:BOOL=OFF