| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | ########################################################################### |
| 4 | # fheroes2: https://github.com/ihhub/fheroes2 # |
| 5 | # Copyright (C) 2025 # |
| 6 | # # |
| 7 | # This program is free software; you can redistribute it and/or modify # |
| 8 | # it under the terms of the GNU General Public License as published by # |
| 9 | # the Free Software Foundation; either version 2 of the License, or # |
| 10 | # (at your option) any later version. # |
| 11 | # # |
| 12 | # This program is distributed in the hope that it will be useful, # |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
| 15 | # GNU General Public License for more details. # |
| 16 | # # |
| 17 | # You should have received a copy of the GNU General Public License # |
| 18 | # along with this program; if not, write to the # |
| 19 | # Free Software Foundation, Inc., # |
| 20 | # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # |
| 21 | ########################################################################### |
| 22 | |
| 23 | set -e -o pipefail |
| 24 | |
| 25 | # We might need to move packages into https://github.com/fheroes2/fheroes2-prebuilt-deps |
| 26 | # repository as we did for other packages. |
| 27 | PKG_NAME="release-2.32.10" |
| 28 | PKG_FILE="$PKG_NAME.zip" |
| 29 | PKG_FILE_SHA256="7a3c207b8509edc487d658df357ad764cd852d68fe248d307b25c0741d52fdf0" |
| 30 | PKG_URL="https://github.com/libsdl-org/SDL/archive/refs/tags/$PKG_FILE" |
| 31 | |
| 32 | TMP_DIR="$(mktemp -d)" |
| 33 | |
| 34 | if [[ -n "$(command -v wget)" ]]; then |
| 35 | wget -O "$TMP_DIR/$PKG_FILE" "$PKG_URL" |
| 36 | elif [[ -n "$(command -v curl)" ]]; then |
| 37 | curl -o "$TMP_DIR/$PKG_FILE" -L "$PKG_URL" |
| 38 | else |
| 39 | echo "Neither wget nor curl were found in your system. Unable to download the package archive. Installation aborted." |
| 40 | exit 1 |
| 41 | fi |
| 42 | |
| 43 | echo "$PKG_FILE_SHA256 *$PKG_FILE" > "$TMP_DIR/checksums" |
| 44 | |
| 45 | if [[ -n "$(command -v shasum)" ]]; then |
| 46 | (cd "$TMP_DIR" && shasum --check --algorithm 256 checksums) |
| 47 | elif [[ -n "$(command -v sha256sum)" ]]; then |
| 48 | (cd "$TMP_DIR" && sha256sum --check --strict checksums) |
| 49 | else |
| 50 | echo "Neither shasum nor sha256sum were found in your system. Unable to verify the downloaded file. Installation aborted." |
| 51 | exit 1 |
| 52 | fi |
| 53 | |
| 54 | unzip -d "$(dirname "$0")/../../ios" "$TMP_DIR/$PKG_FILE" |
| 55 | |
| 56 | mv "$(dirname "$0")/../../ios/SDL-$PKG_NAME" "$(dirname "$0")/../../ios/SDL2" |
| 57 | |
| 58 | PKG_NAME="release-2.8.1" |
| 59 | PKG_FILE="$PKG_NAME.zip" |
| 60 | PKG_FILE_SHA256="3738827df73c86268dfa52898780769d1a796316d73b535e2ab5ff2d8d0ff44f" |
| 61 | PKG_URL="https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/$PKG_FILE" |
| 62 | |
| 63 | if [[ -n "$(command -v wget)" ]]; then |
| 64 | wget -O "$TMP_DIR/$PKG_FILE" "$PKG_URL" |
| 65 | elif [[ -n "$(command -v curl)" ]]; then |
| 66 | curl -o "$TMP_DIR/$PKG_FILE" -L "$PKG_URL" |
| 67 | else |
| 68 | echo "Neither wget nor curl were found in your system. Unable to download the package archive. Installation aborted." |
| 69 | exit 1 |
| 70 | fi |
| 71 | |
| 72 | echo "$PKG_FILE_SHA256 *$PKG_FILE" > "$TMP_DIR/checksums" |
| 73 | |
| 74 | unzip -d "$(dirname "$0")/../../ios" "$TMP_DIR/$PKG_FILE" |
| 75 | |
| 76 | mv "$(dirname "$0")/../../ios/SDL_Mixer-$PKG_NAME" "$(dirname "$0")/../../ios/SDL2_Mixer" |
| 77 | |
| 78 | # Patch SDL_Mixer project. |
| 79 | # It is needed since we are trying to build SDL Mixer using the latest SDL2 version. |
| 80 | # Also, SDL Mixer doesn't support iPhone Simulator so we have to change this code or another one. |
| 81 | sed -i '' 's#$(SRCROOT)/$(PLATFORM)/SDL2.framework/Headers#$(SRCROOT)/../../SDL2/include#' \ |
| 82 | ios/SDL2_Mixer/Xcode/SDL_mixer.xcodeproj/project.pbxproj |