Merge pull request 'feat: add support of golang' (#51) from sisungo/ports:golang into main

Reviewed-on: #51
This commit is contained in:
sisungo committed 2026-10-15 11:25:36 +08:00
commit e4ec67726b
4 files changed
+64

No files matched your search

+7
View File
@@ -9,6 +9,8 @@ all: dict[str, dict[str, str]] = {
"CFLAGS": "-O3 -flto=thin",
"CXXFLAGS": "-O3 -flto=thin",
"LDFLAGS": "-flto=thin",
"GOOS": "linux",
"GOARCH": "arm64",
},
"x86_64-semios-linux": {
"CC": "clang -target x86_64-unknown-linux-musl",
@@ -17,6 +19,9 @@ all: dict[str, dict[str, str]] = {
"CXXFLAGS": "-O3 -march=x86-64-v3 -flto=thin",
"LDFLAGS": "-flto=thin",
"RUSTFLAGS": "-Ctarget-cpu=x86_64-v3",
"GOOS": "linux",
"GOARCH": "amd64",
"GOAMD64": "v3",
},
"riscv64-semios-linux": {
"CC": "clang -target riscv64-unknown-linux-musl",
@@ -24,6 +29,8 @@ all: dict[str, dict[str, str]] = {
"CFLAGS": "-O3 -flto=thin",
"CXXFLAGS": "-O3 -flto=thin",
"LDFLAGS": "-flto=thin",
"GOOS": "linux",
"GOARCH": "riscv64",
},
}
_target: str = packie.host_arch()
+4
View File
@@ -0,0 +1,4 @@
import subprocess
def build():
subprocess.run(["go", "build"], check=True)
+2
View File
@@ -53,6 +53,8 @@ def builddep(s: str):
elif s == "shortcut/rust":
builddep("shortcut/c")
_builddep += ["cargo", "rust"]
elif s == "shortcut/go":
_builddep += ["go", "llvm"]
elif s == "shortcut/cmake":
_builddep += ["cmake", "ninja", "pkgconf"]
elif s == "shortcut/meson":
+51
View File
@@ -0,0 +1,51 @@
import os
import subprocess
from lib.make import *
from lib import go
version("1.27.2")
description("An open-source programming language supported by Google")
maintainer("sisungo <[email protected]>")
source_url("https://go.dev/dl/go1.27.2.src.tar.gz")
builddep("shortcut/go")
builddep("bash")
builddep("gnu-sed")
builddep("grep")
block_hook("autolink")
def build():
os.environ["GOROOT"] = get_prefix("go")
os.chdir("src")
subprocess.run(["./make.bash"], check=True)
os.chdir("../")
subprocess.run(["sh", "-c", "find src \\( -type d -a -name \"*_test.go\" \\) -exec rm -rf \\{\\} +"], check=True)
subprocess.run(["sh", "-c", "find src \\( -type d -a -name testdata \\) -exec rm -rf \\{\\} +"], check=True)
on_build(build)
def pack(composer):
composer.add("bin")
composer.add("go.env")
composer.add("VERSION")
composer.add("lib")
composer.add("misc")
composer.add("pkg")
composer.add("src")
composer.add("api")
def pack_docs(composer):
composer.add("doc")
package("go")
on_pack(pack)
link("bin/go", "/bin/go")
link("bin/gofmt", "/bin/gofmt")
package("go-docs")
on_pack(pack_docs)