From 51e585b2f8a43e098b69a8a57b838255ff03998b Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 8 Jan 2022 17:07:24 -0800 Subject: [PATCH] Fix build scripts around architecture info --- Makefile | 11 +++++++++-- scripts/fpm-bundle.sh | 22 ++++++++++++++++++++-- scripts/release.sh | 16 +++++++++++----- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 02bd5e3..50abe82 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ install: # `make doodads` to build the doodads from the dev-assets folder. .PHONY: doodads doodads: - cd dev-assets/doodads && ./build.sh + cd dev-assets/doodads && ./build.sh > /dev/null # `make mingw` to cross-compile a Windows binary with mingw. .PHONY: mingw @@ -105,13 +105,20 @@ mingw-free: doodads release: ./scripts/release.sh +# `make release32` runs release with ARCH_LABEL=32bit to product +# artifacts targeting an i386 architecture (e.g. in rpm and deb packages +# metadata about the release) +.PHONY: release32 +release32: + env ARCH_LABEL=32bit ./scripts/release.sh + # `make mingw-release` runs a FULL end-to-end release of Linux and Windows # binaries of the game, zipped and tagged and ready to go. .PHONY: mingw-release mingw-release: doodads build mingw __dist-common release .PHONY: mingw32-release -mingw32-release: doodads build mingw32 __dist-common release +mingw32-release: doodads build mingw32 __dist-common release32 # `make osx` to cross-compile a Mac OS binary with osxcross. # .PHONY: osx diff --git a/scripts/fpm-bundle.sh b/scripts/fpm-bundle.sh index e03a5ad..f1bc3af 100755 --- a/scripts/fpm-bundle.sh +++ b/scripts/fpm-bundle.sh @@ -69,11 +69,29 @@ echo ===================== echo Starting fpm package build. echo ===================== +# Get the architecture we're building for, can be provided by +# the user with ARCH_LABEL env variable, it'd be one of: +# x86_64 +# i386 +# aarch64 +if [[ "$ARCH_LABEL" == "" ]]; then + ARCH_LABEL="64bit" + case "$archs" in + i?86) ARCH_LABEL="32bit" ;; + aarch64) ARCH_LABEL="aarch64" ;; + esac +fi +echo "Building packages for architecture $ARCH_LABEL" + # Handle all architectures! Default x86_64 RPM_ARCH="x86_64" DEB_ARCH="x86_64" -case "$archs" in - i?86) +case "$ARCH_LABEL" in + 64bit) + RPM_ARCH="x86_64" + DEB_ARCH="x86_64" + ;; + 32bit) RPM_ARCH="i386" DEB_ARCH="i386" ;; diff --git a/scripts/release.sh b/scripts/release.sh index 0ac7bab..a13ac17 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -20,11 +20,17 @@ STAGE_PATH="$(pwd)/dist/stage/${VERSION}" # Handle all architectures! Default x86_64 # Used in zipfiles for Linux and Windows (fpm-bundle.sh has its own logic) -ARCH_LABEL="64bit" -case "$archs" in - i?86) ARCH_LABEL="32bit" ;; - aarch64) ARCH_LABEL="aarch64" ;; -esac +# User can provide ARCH_LABEL environ variable too. +# One of: 32bit, 64bit, aarch64 +if [[ "$ARCH_LABEL" == "" ]]; then + # Reasonable default + ARCH_LABEL="64bit" + case "$archs" in + i?86) ARCH_LABEL="32bit" ;; + aarch64) ARCH_LABEL="aarch64" ;; + esac +fi +echo "Building packages for architecture $ARCH_LABEL" if [[ ! -d $DIST_PATH ]]; then echo Run this script from the root of the game repository, such that