Skip to content

Commit d8ae0f0

Browse files
committed
add build script
1 parent 46cc8a8 commit d8ae0f0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

build_gurl.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os/exec"
6+
)
7+
8+
func main() {
9+
os := []string{"openbsd", "windows", "linux", "freebsd", "netbsd", "aix", "darwin", "solaris"}
10+
arch := []string{"arm", "arm64", "386", "amd64", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le"}
11+
12+
for _, o := range os {
13+
for _, a := range arch {
14+
testCmd := fmt.Sprintf("env GOPATH=`pwd` CGO_ENABLED=0 GOOS=%s GOARCH=%s go build -o gurl github.com/guonaihong/gurl/", o, a)
15+
cmd := exec.Command("bash", "-c", testCmd)
16+
_, err := cmd.Output()
17+
if err != nil {
18+
fmt.Printf("err :%s:%s\n", err, testCmd)
19+
return
20+
}
21+
22+
cmd2 := exec.Command("bash", "-c", fmt.Sprintf("tar zcvf %s_%s.tar.gz gurl", o, a))
23+
if err = cmd2.Run(); err != nil {
24+
fmt.Printf("err: %s\n", err)
25+
return
26+
}
27+
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)