Skip to content

Instantly share code, notes, and snippets.

@dnicolson
Last active May 23, 2023 06:51
Show Gist options
  • Save dnicolson/9d1937a80476f1943fab5890546e1602 to your computer and use it in GitHub Desktop.
Save dnicolson/9d1937a80476f1943fab5890546e1602 to your computer and use it in GitHub Desktop.
class LlvmMingwW64 < Formula
desc "LLVM/Clang/LLD based mingw-w64 toolchain"
homepage "https://github.com/mstorsjo/llvm-mingw"
version "20230517"
on_macos do
url "https://github.com/mstorsjo/llvm-mingw/releases/download/#{version}/llvm-mingw-#{version}-ucrt-macos-universal.tar.xz"
sha256 "ad4502a4a427aa16736c59e87e2f7657fe8431002133eb286984d25c2bd2c949"
end
on_linux do
on_arm do
url "https://github.com/mstorsjo/llvm-mingw/releases/download/#{version}/llvm-mingw-#{version}-ucrt-ubuntu-20.04-aarch64.tar.xz"
sha256 "236aa276d28ce00ec65ff89c6f50f4d66682edc5c91c3b677af45cd00d60cc84"
end
on_intel do
url "https://github.com/mstorsjo/llvm-mingw/releases/download/#{version}/llvm-mingw-#{version}-ucrt-ubuntu-20.04-x86_64.tar.xz"
sha256 "03292fcd66b9fdb94b390f48599ff2eb9c024d053573ba9088347a9c4e161ecd"
end
end
conflicts_with "mingw-w64"
def install
(prefix/"toolchain").install Dir["./*"]
Dir.glob(prefix/"toolchain/bin/*") { |file| bin.install_symlink file }
["clang-target", "ld", "objdump"].each do |wrapper|
inreplace prefix/"toolchain/bin/#{wrapper}-wrapper.sh", 'dirname "$0"', 'dirname $(readlink -f "$0")'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment