Skip to content

Commit 3a5cb0c

Browse files
committed
building compiler now needs flock
also manually populate submodules to avoid unnecessary clones
1 parent cff0729 commit 3a5cb0c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

riscv-gnu-toolchain.rb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
1+
# Avoids pulling in all submodules because so big, especially w/ recursive
2+
class NoRecursiveGitDownloadStrategy < GitDownloadStrategy
3+
sig { params(timeout: T.nilable(Time)).void }
4+
def update(timeout: nil)
5+
config_repo
6+
update_repo(timeout: timeout)
7+
checkout(timeout: timeout)
8+
reset
9+
# update_submodules(timeout: timeout) if submodules?
10+
end
11+
12+
sig { params(timeout: T.nilable(Time)).void }
13+
def clone_repo(timeout: nil)
14+
command! "git", args: clone_args, timeout: timeout&.remaining
15+
16+
command! "git",
17+
args: ["config", "homebrew.cacheversion", cache_version],
18+
chdir: cached_location,
19+
timeout: timeout&.remaining
20+
checkout(timeout: timeout)
21+
# update_submodules(timeout: timeout) if submodules?
22+
end
23+
end
24+
125
class RiscvGnuToolchain < Formula
226
desc "RISC-V Compiler GNU Toolchain using newlib"
327
homepage "http://riscv.org"
4-
url "https://github.com/riscv/riscv-gnu-toolchain.git"
28+
url "https://github.com/riscv/riscv-gnu-toolchain.git", :using => NoRecursiveGitDownloadStrategy
529
version "main"
630

731
bottle do
@@ -15,6 +39,7 @@ class RiscvGnuToolchain < Formula
1539

1640
depends_on "gawk" => :build
1741
depends_on "gnu-sed" => :build
42+
depends_on "flock" => :build
1843
depends_on "gmp"
1944
depends_on "isl"
2045
depends_on "libmpc"
@@ -25,6 +50,11 @@ def install
2550
# disable crazy flag additions
2651
ENV.delete "CPATH"
2752

53+
# need to pull in needed submodules (now that they are disabled above)
54+
system "git", "submodule", "update", "--init", "--recursive", "newlib"
55+
system "git", "submodule", "update", "--init", "--recursive", "riscv-binutils"
56+
system "git", "submodule", "update", "--init", "--recursive", "riscv-gcc"
57+
2858
args = [
2959
"--prefix=#{prefix}",
3060
"--with-cmodel=medany",

0 commit comments

Comments
 (0)