joeybuild/helpers/SDL2.helper

82 lines
2.1 KiB
Bash

#!/bin/bash
#
# JoeyBuild
# Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
#
function buildJoeyLibSDL2() {
local PASS=$1
rm -rf ${G_DIST}
mkdir -p ${G_DIST}
pushd ${G_DIST}
if [[ "${PASS}" == "debug" ]]; then
${CC} ${CFLAGS} -I${G_SRC}/3rdparty/memwatch -o memwatch.o ${G_SRC}/3rdparty/memwatch/memwatch.c
fi
${CC} ${CFLAGS} -o jPixBuf.o ${G_SRC}/jPixBuf.c
${CC} ${CFLAGS} -o jSDL2.o ${G_SRC}/jSDL2.c
${CC} ${CFLAGS} -o joey.o ${G_SRC}/joey.c
${AR} x ${G_INSTALLED}/lib/libSDL2.a
${AR} x ${G_INSTALLED}/lib/libSDL2main.a
${AR} rcs libjoeylib.a *.o
rm *.o
[[ -f __.SYMDEF ]] && rm __.SYMDEF*
popd
}
function buildSDL2() {
local TAG=$1
local TRIPLE=$2
if [[ ! -d SDL_Clean ]]; then
git clone https://skunkworks.kangaroopunch.com/mirrors/SDL.git SDL_Clean
fi
rm -rf SDL || true
cp -R SDL_Clean SDL
pushd SDL
git checkout ${TAG}
popd
rm -rf build || true
mkdir -p build
pushd build
../SDL/autogen.sh
../SDL/configure \
--target=${TRIPLE} \
--host=${TRIPLE} \
--build=x86_64-linux \
--enable-static \
--disable-shared \
--disable-video-wayland \
--disable-render-metal \
--disable-video-metal \
--prefix=${G_INSTALLED} 1>&2
make 1>&2
make install 1>&2
popd
}