/
guile.rb
109 lines (90 loc) 路 4.01 KB
/
guile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
class Guile < Formula
desc "GNU Ubiquitous Intelligent Language for Extensions"
homepage "https://www.gnu.org/software/guile/"
url "https://ftp.gnu.org/gnu/guile/guile-3.0.9.tar.xz"
mirror "https://ftpmirror.gnu.org/guile/guile-3.0.9.tar.xz"
sha256 "1a2625ac72b2366e95792f3fe758fd2df775b4044a90a4a9787326e66c0d750d"
license "LGPL-3.0-or-later"
revision 1
bottle do
sha256 arm64_sonoma: "4cfcd9e34a96fe072bece6b1fbde207bca7a199abb301bf7a905d59b0a0beb45"
sha256 arm64_ventura: "b279b06347094774fb46580d7041dc1e5017561c15b87b970b759807b1ea8492"
sha256 arm64_monterey: "25b50c7a95da0ec243e171db63b26ca1237ac9a28e36a34ab94cd464b6487fef"
sha256 sonoma: "0f96a1041a637d901cad5ba39c755353b9de2f776b231248b8645e32714ad7d9"
sha256 ventura: "6b84ab0f14f06a81ac232b8c97abea33db4884644586ee5a96d94cc840041a6d"
sha256 monterey: "a20e7b2489f6c37c1afa2b55d160f4dba10e99c5286ef2182d1d04f757bef36c"
sha256 x86_64_linux: "01bd0704d493a88f8fe2210d7f75d3ade620f8ff6704c2cc342d72663611b611"
end
head do
url "https://git.savannah.gnu.org/git/guile.git", branch: "main"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gettext" => :build
uses_from_macos "flex" => :build
on_system :linux, macos: :ventura_or_newer do
depends_on "texinfo" => :build
end
end
depends_on "gnu-sed" => :build
depends_on "bdw-gc"
depends_on "gmp"
depends_on "libtool"
depends_on "libunistring"
depends_on "pkg-config" # guile-config is a wrapper around pkg-config.
depends_on "readline"
uses_from_macos "gperf"
uses_from_macos "libffi", since: :catalina
uses_from_macos "libxcrypt"
def install
# So we can find libraries with (dlopen).
ENV.append "LDFLAGS", "-Wl,-rpath,#{HOMEBREW_PREFIX}/lib"
# Avoid superenv shim
inreplace "meta/guile-config.in", "@PKG_CONFIG@", Formula["pkg-config"].opt_bin/"pkg-config"
system "./autogen.sh" unless build.stable?
system "./configure", *std_configure_args,
"--with-libreadline-prefix=#{Formula["readline"].opt_prefix}",
"--with-libgmp-prefix=#{Formula["gmp"].opt_prefix}",
"--disable-nls"
system "make", "install"
# A really messed up workaround required on macOS --mkhl
Pathname.glob("#{lib}/*.dylib") do |dylib|
lib.install_symlink dylib.basename => "#{dylib.basename(".dylib")}.so"
end
# This is either a solid argument for guile including options for
# --with-xyz-prefix= for libffi and bdw-gc or a solid argument for
# Homebrew automatically removing Cellar paths from .pc files in favour
# of opt_prefix usage everywhere.
inreplace lib/"pkgconfig/guile-3.0.pc" do |s|
s.gsub! Formula["bdw-gc"].prefix.realpath, Formula["bdw-gc"].opt_prefix
s.gsub! Formula["libffi"].prefix.realpath, Formula["libffi"].opt_prefix if !OS.mac? || MacOS.version < :catalina
end
(share/"gdb/auto-load").install Dir["#{lib}/*-gdb.scm"]
end
def post_install
# Create directories so installed modules can create links inside.
(HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache").mkpath
(HOMEBREW_PREFIX/"lib/guile/3.0/extensions").mkpath
(HOMEBREW_PREFIX/"share/guile/site/3.0").mkpath
end
def caveats
<<~EOS
Guile libraries can now be installed here:
Source files: #{HOMEBREW_PREFIX}/share/guile/site/3.0
Compiled files: #{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache
Extensions: #{HOMEBREW_PREFIX}/lib/guile/3.0/extensions
Add the following to your .bashrc or equivalent:
export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0"
export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache"
export GUILE_SYSTEM_EXTENSIONS_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/extensions"
EOS
end
test do
hello = testpath/"hello.scm"
hello.write <<~EOS
(display "Hello World")
(newline)
EOS
ENV["GUILE_AUTO_COMPILE"] = "0"
system bin/"guile", hello
end
end