Skip to content

Commit 4b35233

Browse files
authored
Add more archs to s2sx (#333)
* Add more archs to s2sx * Compress the internal images. * Move packages to bottom.
1 parent 26a590d commit 4b35233

File tree

7 files changed

+60
-8
lines changed

7 files changed

+60
-8
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ _testmain.go
2222
*.exe
2323
*.test
2424
*.prof
25-
/s2/cmd/_sfx/sfx-exe
25+
/s2/cmd/_s2sx/sfx-exe

.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ changelog:
114114

115115
nfpms:
116116
-
117-
file_name_template: "s2-Install_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
117+
file_name_template: "s2_package_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
118118
vendor: Klaus Post
119119
homepage: https://github.com/klauspost/compress
120120
maintainer: Klaus Post <klauspost@gmail.com>

s2/README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,19 @@ Options:
247247
Do not overwrite output files
248248
-untar
249249
Untar on destination
250+
```
250251

251252
Available platforms are:
252253

253254
* darwin-amd64
255+
* darwin-arm64
254256
* linux-amd64
255-
* windows-amd64
256-
```
257+
* linux-arm
258+
* linux-arm64
259+
* linux-mips64
260+
* linux-ppc64le
261+
* windows-386
262+
* windows-amd64
257263

258264
### Self-extracting TAR files
259265

s2/cmd/_s2sx/gensfx.cmd

+25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1+
go build ../s2c
2+
3+
DEL /Q sfx-exe\*
4+
15
SET GOOS=linux
26
SET GOARCH=amd64
37
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
8+
SET GOARCH=arm64
9+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
10+
SET GOARCH=arm
11+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
12+
SET GOARCH=ppc64le
13+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
14+
SET GOARCH=mips64
15+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
16+
17+
418
SET GOOS=darwin
19+
SET GOARCH=amd64
520
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
21+
SET GOARCH=arm64
22+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
23+
624
SET GOOS=windows
25+
SET GOARCH=amd64
26+
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
27+
SET GOARCH=386
728
go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go
29+
30+
s2c.exe -rm -slower sfx-exe\*
31+
DEL /Q s2c.exe
32+

s2/cmd/_s2sx/gensfx.sh

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/bin/sh
22

3+
go build -o=s2c ../s2c
4+
5+
rm -rf sfx-exe/ || true
6+
37
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
8+
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
9+
GOOS=linux GOARCH=arm go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
10+
GOOS=linux GOARCH=ppc64le go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
11+
GOOS=linux GOARCH=mpis64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
12+
413
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
14+
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
15+
516
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
17+
GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o ./sfx-exe/$GOOS-$GOARCH ./_unpack/main.go
18+
19+
./s2c -rm -slower sfx-exe/*
20+
21+
rm s2c

s2/cmd/_s2sx/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/klauspost/compress/s2/cmd/_s2sx
1+
module github.com/klauspost/compress/s2/cmd/s2sx
22

33
go 1.16
44

s2/cmd/_s2sx/main.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package main
22

33
import (
44
"bufio"
5+
"bytes"
56
"embed"
67
"errors"
78
"flag"
89
"fmt"
910
"io"
11+
"io/ioutil"
1012
"os"
1113
"path"
1214
"path/filepath"
@@ -66,7 +68,7 @@ Options:`)
6668
exitErr(err)
6769
_, _ = fmt.Fprintf(os.Stderr, "\nAvailable platforms are:\n\n")
6870
for _, d := range dir {
69-
_, _ = fmt.Fprintf(os.Stderr, " * %s\n", d.Name())
71+
_, _ = fmt.Fprintf(os.Stderr, " * %s\n", strings.TrimSuffix(d.Name(), ".s2"))
7072
}
7173

7274
os.Exit(0)
@@ -84,17 +86,20 @@ Options:`)
8486
files = append(files, found...)
8587
}
8688
wantPlat := *goos + "-" + *goarch
87-
exec, err := embeddedFiles.ReadFile(path.Join("sfx-exe", wantPlat))
89+
exec, err := embeddedFiles.ReadFile(path.Join("sfx-exe", wantPlat+".s2"))
8890
if os.IsNotExist(err) {
8991
dir, err := embeddedFiles.ReadDir("sfx-exe")
9092
exitErr(err)
9193
_, _ = fmt.Fprintf(os.Stderr, "os-arch %v not available. Available sfx platforms are:\n\n", wantPlat)
9294
for _, d := range dir {
93-
_, _ = fmt.Fprintf(os.Stderr, "* %s\n", d.Name())
95+
_, _ = fmt.Fprintf(os.Stderr, "* %s\n", strings.TrimSuffix(d.Name(), ".s2"))
9496
}
9597
_, _ = fmt.Fprintf(os.Stderr, "\nUse -os and -arch to specify the destination platform.")
9698
os.Exit(1)
9799
}
100+
exec, err = ioutil.ReadAll(s2.NewReader(bytes.NewBuffer(exec)))
101+
exitErr(err)
102+
98103
mode := byte(opUnpack)
99104
if *untar {
100105
mode = opUnTar

0 commit comments

Comments
 (0)