Skip to content

Commit 5a65e52

Browse files
authored
Merge pull request #185 from plispe/freebsd-support
FreeBSD support
2 parents a4bca58 + 399062e commit 5a65e52

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build:
1414
install: build
1515
$(GO) install $(GO_FLAGS)
1616

17-
build-all: build-linux build-darwin build-windows
17+
build-all: build-linux build-darwin build-windows build-freebsd
1818

1919
build-linux: build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x build-linux-riscv64
2020
build-linux-386:
@@ -48,6 +48,19 @@ build-windows-arm:
4848
build-windows-arm64:
4949
GOOS=windows GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/windows-arm64/g.exe
5050

51+
52+
build-freebsd: build-freebsd-386 build-freebsd-amd64 build-freebsd-arm build-freebsd-arm64 build-freebsd-riscv64
53+
build-freebsd-386:
54+
GOOS=freebsd GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/freebsd-386/g
55+
build-freebsd-amd64:
56+
GOOS=freebsd GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/freebsd-amd64/g
57+
build-freebsd-arm:
58+
GOOS=freebsd GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/freebsd-arm/g
59+
build-freebsd-arm64:
60+
GOOS=freebsd GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/freebsd-arm64/g
61+
build-freebsd-riscv64:
62+
GOOS=freebsd GOARCH=riscv64 $(GO) build $(GO_FLAGS) -o bin/freebsd-riscv64/g
63+
5164
package:
5265
sh ./package.sh
5366

@@ -101,4 +114,4 @@ upgrade-deps:
101114
mcp-inspector: build
102115
npx @modelcontextprotocol/inspector ./bin/g mcp
103116

104-
.PHONY: all build install install-tools lint test test-coverage view-coverage addlicense package clean upgrade-deps mcp-inspector build-linux build-darwin build-windows build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x build-linux-riscv64 build-darwin-amd64 build-darwin-arm64 build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64
117+
.PHONY: all build install install-tools lint test test-coverage view-coverage addlicense package clean upgrade-deps mcp-inspector build-linux build-darwin build-windows build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x build-linux-riscv64 build-darwin-amd64 build-darwin-arm64 build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64 build-freebsd-386 build-freebsd-amd64 build-freebsd-arm build-freebsd-arm64 build-freebsd-riscv64

install.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,36 @@ if test -s "$HOME/.g/env.fish"; and source "$HOME/.g/env.fish"; end
107107
EOF_G_FISH_CONF
108108
fi
109109

110+
if [ -x "$(command -v csh)" ]; then
111+
cat >>${HOME}/.cshrc <<-'EOF'
112+
setenv GOROOT "$HOME/.g/go"
113+
114+
if ( ! $?GOPATH ) then
115+
setenv GOPATH "$HOME/go"
116+
else if ( "$GOPATH" == "" ) then
117+
setenv GOPATH "$HOME/go"
118+
endif
119+
120+
setenv PATH "$HOME/.g/bin:$GOROOT/bin:$GOPATH/bin:$PATH"
121+
setenv G_MIRROR "https://golang.google.cn/dl/"
122+
EOF
123+
fi
124+
125+
if [ -x "$(command -v tcsh)" ]; then
126+
cat >>${HOME}/.tcshrc <<-'EOF'
127+
setenv GOROOT "$HOME/.g/go"
128+
129+
if ( ! $?GOPATH ) then
130+
setenv GOPATH "$HOME/go"
131+
else if ( "$GOPATH" == "" ) then
132+
setenv GOPATH "$HOME/go"
133+
endif
134+
135+
setenv PATH "$HOME/.g/bin:$GOROOT/bin:$GOPATH/bin:$PATH"
136+
setenv G_MIRROR "https://golang.google.cn/dl/"
137+
EOF
138+
fi
139+
110140
echo -e "\nTo configure your current shell, run:\nsource \"$HOME/.g/env\""
111141

112142
exit 0

package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function package() {
3939
local os=${osarch[0]}
4040
local arch=${osarch[1]}
4141

42-
printf "[1/2] Cross compile@%s_%s\n" ${os} ${arch}
42+
printf "[1origin freebsd-support/2] Cross compile@%s_%s\n" ${os} ${arch}
4343
GOOS=${os} GOARCH=${arch} gbb
4444

4545
printf "[2/2] Package\n"
@@ -59,7 +59,7 @@ main() {
5959

6060
local release="1.8.0"
6161

62-
for item in "darwin_amd64" "darwin_arm64" "linux_386" "linux_amd64" "linux_arm" "linux_arm64" "linux_s390x" "linux_riscv64" "windows_386" "windows_amd64" "windows_arm" "windows_arm64"; do
62+
for item in "darwin_amd64" "darwin_arm64" "linux_386" "linux_amd64" "linux_arm" "linux_arm64" "linux_s390x" "linux_riscv64" "windows_386" "windows_amd64" "windows_arm" "windows_arm64 build-freebsd-386 freebsd_amd64 freebsd_arm freebsd_arm64 freebsd_riscv64"; do
6363
package ${release} ${item}
6464
done
6565

0 commit comments

Comments
 (0)