Skip to content

llgo 0.12.0 pretest with go1.24 #234046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions Formula/l/llgo.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class Llgo < Formula
desc "Go compiler based on LLVM integrate with the C ecosystem and Python"
homepage "https://github.com/goplus/llgo"
url "https://github.com/goplus/llgo/archive/refs/tags/v0.11.5.tar.gz"
sha256 "e025993d12c1f5e49e5b8dcb31c0e8b349efe56970d1a23d6c089ebd10928c6b"
homepage "https://github.com/luoliwoshang/llgo"
url "https://github.com/luoliwoshang/llgo/archive/refs/tags/v0.12.7.tar.gz"
sha256 "a3a8c8095be50dcc8f13a379617399eb820815063b471c6284a060198298c652"
license "Apache-2.0"
head "https://github.com/goplus/llgo.git", branch: "main"
head "https://github.com/luoliwoshang/llgo.git", branch: "internal/build/rpath"

livecheck do
url :stable
Expand All @@ -21,7 +21,7 @@ class Llgo < Formula
end

depends_on "bdw-gc"
depends_on "go"
depends_on "go@1.24"
depends_on "libffi"
depends_on "libuv"
depends_on "lld@19"
Expand All @@ -30,10 +30,6 @@ class Llgo < Formula
depends_on "pkgconf"
uses_from_macos "zlib"

on_linux do
depends_on "libunwind"
end

def find_dep(name)
deps.map(&:to_formula).find { |f| f.name.match?(/^#{name}(@\d+)?$/) }
end
Expand Down Expand Up @@ -66,9 +62,8 @@ def install
script_env = { PATH: "#{path_deps.join(":")}:$PATH" }

if OS.linux?
libunwind = find_dep("libunwind")
script_env[:CFLAGS] = "-I#{libunwind.opt_include} $CFLAGS"
script_env[:LDFLAGS] = "-L#{libunwind.opt_lib} -rpath #{libunwind.opt_lib} $LDFLAGS"
script_env[:CFLAGS] = "-I#{llvm.opt_include} $CFLAGS"
script_env[:LDFLAGS] = "-L#{llvm.opt_lib} -rpath #{llvm.opt_lib} $LDFLAGS"
end

(libexec/"bin").children.each do |f|
Expand Down Expand Up @@ -96,6 +91,7 @@ def install
"fmt"

"github.com/goplus/lib/c"
"github.com/goplus/lib/cpp/std"
)

func Foo() string {
Expand All @@ -105,6 +101,7 @@ def install
func main() {
fmt.Println("Hello LLGO by fmt.Println")
c.Printf(c.Str("Hello LLGO by c.Printf\\n"))
c.Printf(std.Str("Hello LLGO by cpp/std.Str\\n").CStr())
}
GO
(testpath/"hello_test.go").write <<~GO
Expand All @@ -126,12 +123,14 @@ module hello
system "go", "get", "github.com/goplus/lib"
# Test llgo run
assert_equal "Hello LLGO by fmt.Println\n" \
"Hello LLGO by c.Printf\n",
"Hello LLGO by c.Printf\n" \
"Hello LLGO by cpp/std.Str\n",
shell_output("#{bin}/llgo run .")
# Test llgo build
system bin/"llgo", "build", "-o", "hello", "."
assert_equal "Hello LLGO by fmt.Println\n" \
"Hello LLGO by c.Printf\n",
"Hello LLGO by c.Printf\n" \
"Hello LLGO by cpp/std.Str\n",
shell_output("./hello")
# Test llgo test
assert_match "PASS", shell_output("#{bin}/llgo test .")
Expand Down
Loading