joeylib2/installer/components/sdl3Psp.sh
2026-10-13 14:01:46 -05:00

55 lines
1.6 KiB
Bash

# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
# See LICENSE.md for license information.
# SPDX-License-Identifier: MIT
#
# SDL 3 built with pspdev, static, for the psp port (make psp): the same
# release source the sdl3 component builds for the host (its pin is read from
# sdl3.sh, so there is one), cross-compiled with pspdev's CMake toolchain
# file into toolchains/opt/sdl3Psp. pspdev carries an SDL3 of its own; the
# port links this one, so every SDL3 port runs the same SDL.
compDescription="psp: SDL 3 for the PSP, static (psp port)"
compGroups="toolchain:psp"
compRequires="host pspdev"
compHostDeps="cmake"
sdl3Url="$(compQuery sdl3 compUrl)"
sdl3Sha256="$(compQuery sdl3 compSha256)"
compPin="$sdl3Sha256:$(compQuery pspdev compPin)"
compInstall() {
local archive
local src
archive="$(fetchFile "$sdl3Url" "$sdl3Sha256")"
src="$(freshBuildDir "$compId")"
extractArchive "$archive" "$src" 1
export PSPDEV="$JOEY_OPT/pspdev"
cmake -S "$src" -B "$src/build" \
-DCMAKE_TOOLCHAIN_FILE="$PSPDEV/psp/share/pspdev.cmake" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$compDir" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DSDL_SHARED=OFF \
-DSDL_STATIC=ON \
-DSDL_TESTS=OFF \
-DSDL_EXAMPLES=OFF
cmake --build "$src/build" -j"$JOEY_JOBS"
rm -rf "$compDir"
cmake --install "$src/build"
dropBuildDir "$compId"
}
compInstalled() {
[ -f "$compDir/lib/libSDL3.a" ] && [ -f "$compDir/include/SDL3/SDL.h" ]
}
compVerify() {
compInstalled
}
compEnv() {
envVar SDL3_PSP_DIR "$compDir"
}