Skip to content

Commit d4fbcec

Browse files
committed
fricas: workaround to avoid corrupted Linux bottles
1 parent 34d1f83 commit d4fbcec

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

Formula/f/fricas.rb

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ class Fricas < Formula
3030
depends_on "sbcl"
3131
depends_on "zstd"
3232

33+
on_linux do
34+
# Patchelf will corrupt the SBCL core which is appended to binary.
35+
on_arm do
36+
pour_bottle? only_if: :default_prefix
37+
end
38+
on_intel do
39+
pour_bottle? only_if: :default_prefix
40+
end
41+
end
42+
3343
def install
3444
args = [
3545
"--with-lisp=sbcl",
@@ -41,12 +51,27 @@ def install
4151
system "make"
4252
system "make", "install"
4353
end
54+
55+
# Work around patchelf corrupting the SBCL core which is appended to binary
56+
# TODO: Find a better way to handle this in brew, either automatically or via DSL
57+
if OS.linux? && build.bottle?
58+
cd lib/"fricas" do
59+
system "tar", "-czf", "target.tar.gz", "target"
60+
rm_r("target")
61+
end
62+
end
4463
end
4564

46-
test do
47-
# Fails in Linux CI with "Can't find sbcl.core"
48-
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]
65+
def post_install
66+
if (lib/"fricas/target.tar.gz").exist?
67+
cd lib/"fricas" do
68+
system "tar", "-xzf", "target.tar.gz"
69+
rm("target.tar.gz")
70+
end
71+
end
72+
end
4973

74+
test do
5075
assert_match %r{ \(/ \(pi\) 2\)\n},
5176
pipe_output("#{bin}/fricas -nosman", "integrate(sqrt(1-x^2),x=-1..1)::InputForm")
5277
end

0 commit comments

Comments
 (0)