Skip to content

Commit

Permalink
simplify itchio native builds releases
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte committed Nov 2, 2023
1 parent 9286c2d commit 33a05ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
20 changes: 17 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ COMMIT_HASH=`git rev-parse HEAD`
steam-release:
rm -rf ../steam_dist
mkdir -p ../steam_dist/linux_x86-64 ../steam_dist/windows_x86-32 ../steam_dist/windows_x86-64 ../steam_dist/out
go run ./cmd/builder -o ../steam_dist/linux_x86-64/roboden -steam -goos=linux -goarch=amd64
go run ./cmd/builder -o ../steam_dist/windows_x86-32/roboden.exe -steam -goos=windows -goarch=386
go run ./cmd/builder -o ../steam_dist/windows_x86-64/roboden.exe -steam -goos=windows -goarch=amd64
go run ./cmd/builder -o ../steam_dist/linux_x86-64/roboden -platform=steam -goos=linux -goarch=amd64
go run ./cmd/builder -o ../steam_dist/windows_x86-32/roboden.exe -platform=steam -goos=windows -goarch=386
go run ./cmd/builder -o ../steam_dist/windows_x86-64/roboden.exe -platform=steam -goos=windows -goarch=amd64
cp -r ../roboden_data ../steam_dist/linux_x86-64/roboden_data
cp -r ../roboden_data ../steam_dist/windows_x86-32/roboden_data
cp -r ../roboden_data ../steam_dist/windows_x86-64/roboden_data
Expand All @@ -18,6 +18,20 @@ steam-release:
cd ../steam_dist/windows_x86-64 && zip -r ../out/roboden_windows64.zip *
@echo "[OK] all done"

itchio-release:
rm -rf ../itchio_dist
mkdir -p ../itchio_dist/linux_x86-64 ../itchio_dist/windows_x86-32 ../itchio_dist/windows_x86-64 ../itchio_dist/out
go run ./cmd/builder -o ../itchio_dist/linux_x86-64/roboden -platform=itchio -goos=linux -goarch=amd64
go run ./cmd/builder -o ../itchio_dist/windows_x86-32/roboden.exe -platform=itchio -goos=windows -goarch=386
go run ./cmd/builder -o ../itchio_dist/windows_x86-64/roboden.exe -platform=itchio -goos=windows -goarch=amd64
cp -r ../roboden_data ../itchio_dist/linux_x86-64/roboden_data
cp -r ../roboden_data ../itchio_dist/windows_x86-32/roboden_data
cp -r ../roboden_data ../itchio_dist/windows_x86-64/roboden_data
cd ../itchio_dist/linux_x86-64 && zip -r ../out/roboden_linux.zip *
cd ../itchio_dist/windows_x86-32 && zip -r ../out/roboden_windows32.zip *
cd ../itchio_dist/windows_x86-64 && zip -r ../out/roboden_windows64.zip *
@echo "[OK] all done"

server:
go build -ldflags="-s -w -X 'main.CommitHash=$(COMMIT_HASH)'" -trimpath -o server ./cmd/server

Expand Down
15 changes: 10 additions & 5 deletions src/cmd/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func main() {
"select a cross-compilation GOOS value")
flag.StringVar(&args.goarch, "goarch", "",
"select a cross-compilation GOARCH value")
flag.BoolVar(&args.steam, "steam", false,
"whether we're building for Steam")
flag.StringVar(&args.platform, "platform", "",
"a platform-specific tag (steam, itchio)")
flag.Parse()

commit := args.commit
Expand All @@ -37,8 +37,13 @@ func main() {
"-s -w",
}
buildTags := []string{}
if args.steam {
buildTags = append(buildTags, "steam")
switch args.platform {
case "steam", "itchio":
buildTags = append(buildTags, args.platform)
case "":
// OK.
default:
panic(fmt.Sprintf("unexpected platform flag: %q", args.platform))
}
goFlags := []string{
"build",
Expand Down Expand Up @@ -70,5 +75,5 @@ type arguments struct {
goos string
goarch string

steam bool
platform string
}

0 comments on commit 33a05ac

Please sign in to comment.