Skip to content

Commit

Permalink
Merge pull request #196319 from Homebrew/flang-ci-builds
Browse files Browse the repository at this point in the history
flang: speed up CI builds
  • Loading branch information
BrewTestBot authored Nov 1, 2024
2 parents e4a9c47 + 8d5bc6b commit d9d97f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Formula/f/flang.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Flang < Formula
end

depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "llvm"

# Building with GCC fails at linking with an obscure error.
Expand All @@ -34,6 +35,7 @@ def install
llvm = Formula["llvm"]
# NOTE: Setting `BUILD_SHARED_LIBRARIES=ON` causes the just-built flang to throw ICE.
args = %W[
-G Ninja
-DCLANG_DIR=#{llvm.opt_lib}/cmake/clang
-DFLANG_INCLUDE_TESTS=OFF
-DFLANG_REPOSITORY_STRING=#{tap&.issues_url}
Expand All @@ -46,6 +48,8 @@ def install
-DMLIR_DIR=#{llvm.opt_lib}/cmake/mlir
]
args << "-DFLANG_VENDOR_UTI=sh.brew.flang" if tap&.official?
# Linking takes an absurd amount of memory. Try to limit it to no more than 4GB per link job.
args << "-DLLVM_RAM_PER_LINK_JOB=#{4 * 1024}" if ENV["HOMEBREW_GITHUB_ACTIONS"].present?

ENV.append_to_cflags "-ffat-lto-objects" if OS.linux? # Unsupported on macOS.
install_prefix = libexec
Expand Down

0 comments on commit d9d97f3

Please sign in to comment.