From 6f90141a3b8cf6354ac6a9642534c4a348c68811 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 11 Apr 2022 10:55:46 -0400 Subject: [PATCH] Add script to build binaries for all platforms --- .dockerignore | 2 ++ Dockerfile.binary | 6 +++++- debian/build-binaries.sh | 42 ++++++++++++++++++++++++++++++++++++++++ debian/build-debian.sh | 2 +- 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 debian/build-binaries.sh diff --git a/.dockerignore b/.dockerignore index dce5c6d..1622c5b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,8 @@ !install.sh !pyinstaller/*.py !pyinstaller/mimic3-server +!pyinstaller/mimic3-client +!pyinstaller/mimic3-download # opentts-abc !opentts-abc/setup.py diff --git a/Dockerfile.binary b/Dockerfile.binary index f9cc80b..8eee244 100644 --- a/Dockerfile.binary +++ b/Dockerfile.binary @@ -92,7 +92,11 @@ RUN find dist/mimic3/ -wholename '*/gruut_lang_*/espeak' -type d | \ rm -rf "${espeak_dir}"; \ done -COPY pyinstaller/mimic3-server dist/mimic3/ +# Copy convenience scripts +COPY pyinstaller/mimic3-server \ + pyinstaller/mimic3-client \ + pyinstaller/mimic3-download \ + dist/mimic3/ # ----------------------------------------------------------------------------- diff --git a/debian/build-binaries.sh b/debian/build-binaries.sh new file mode 100755 index 0000000..0aacefa --- /dev/null +++ b/debian/build-binaries.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Copyright 2022 Mycroft AI Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# ----------------------------------------------------------------------------- +# +# Builds PyInstaller binaries for all platforms. +# +set -eo pipefail + +# Directory of *this* script +this_dir="$( cd "$( dirname "$0" )" && pwd )" +src_dir="$(realpath "${this_dir}/..")" + +if [ -z "$1" ]; then + # All platforms + platforms=('amd64' 'arm64' 'arm/v7') +else + # Only platforms from command-line arguments + platforms=("$@") +fi + +pushd "${src_dir}" + +for platform in "${platforms[@]}"; do + DOCKER_PLATFORMS="${platform}" \ + make binaries +done + +popd diff --git a/debian/build-debian.sh b/debian/build-debian.sh index c4f0f43..738ab27 100755 --- a/debian/build-debian.sh +++ b/debian/build-debian.sh @@ -20,7 +20,7 @@ # Before running this script, you must build PyInstaller binaries with "make # binaries" or by manually invoking Dockerfile.binary. # ----------------------------------------------------------------------------- -set -euo pipefail +set -eo pipefail # Directory of *this* script this_dir="$( cd "$( dirname "$0" )" && pwd )"