@@ -5,8 +5,9 @@ if len($ARGS) != "2" {
5
5
exit(" 1" )
6
6
}
7
7
8
- version = $ARGS [1]
9
- supported_os = (" linux" " darwin" " windows" )
8
+ version = $ARGS [1]
9
+ supported_os = (" linux" " darwin" " windows" )
10
+ supported_arch = (" amd64" )
10
11
11
12
# Guarantee passing tests at least on the host arch/os
12
13
make test
@@ -15,31 +16,42 @@ setenv CGO_ENABLED = "0"
15
16
16
17
mkdir -p dist
17
18
18
- fn copy_exec(src, dst ) {
19
+ fn prepare_execs(distfiles, os ) {
19
20
if $os == " windows" {
20
- src = $src +" .exe"
21
- dst = $dst +" .exe"
21
+ newfiles = ()
22
+
23
+ for distfile in $distfiles {
24
+ file = $distfile +" .exe"
25
+
26
+ newfiles < = append($newfiles , $file )
27
+ }
28
+
29
+ return $newfiles
30
+ }
31
+ if $os == " linux" {
32
+ for distfile in $distfiles {
33
+ strip $distfile
34
+ }
22
35
}
23
36
24
- cp $src $dst
37
+ return $distfiles
25
38
}
26
39
27
40
for os in $supported_os {
28
- setenv GOOS = $os
29
- setenv GOARCH = " amd64"
30
-
31
- echo " building OS: " +$GOOS +" ARCH : " +$GOARCH
32
- make build " version=" +$version
33
-
34
- source_nash = " cmd/nash/nash"
41
+ for arch in $supported_arch {
42
+ setenv GOOS = $os
43
+ setenv GOARCH = $arch
35
44
36
- target_nash < = format(" dist/nash-%s-%s-amd64" , $version , $os )
45
+ echo " building OS: " +$GOOS +" ARCH : " +$GOARCH
46
+ make build " version=" +$version
37
47
38
- copy_exec($source_nash , $target_nash )
48
+ nash = " cmd/nash/nash"
49
+ nashfmt = " cmd/nashfmt/nashfmt"
50
+ execfiles = ($nash $nashfmt )
39
51
40
- source_nashfmt = " cmd/nashfmt/nashfmt"
52
+ distfiles < = prepare_execs($execfiles , $os )
53
+ distar < = format(" dist/nash-%s-%s-%s.tar.gz" , $version , $os , $arch )
41
54
42
- target_nashfmt < = format(" dist/nashfmt-%s-%s-amd64" , $version , $os )
43
-
44
- copy_exec($source_nashfmt , $target_nashfmt )
55
+ tar cvfz $distar $distfiles
56
+ }
45
57
}
0 commit comments