143 lines
3.1 KiB
Bash
143 lines
3.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.
|
|
#
|
|
|
|
|
|
M_SDL2_TAG=97a5e744497ff7cc93edc5119d67cad3ee86dd57
|
|
M_TRIPLE=
|
|
|
|
|
|
source ${G_EHOME}/helpers/SDL2.helper
|
|
source ${G_EHOME}/helpers/GCC.helper
|
|
|
|
|
|
function architectures() {
|
|
echo "i686 x86_64"
|
|
}
|
|
|
|
|
|
function assemble() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
local LOG=$3
|
|
local AFILES=(${*:4})
|
|
|
|
setCompiler ${ARCH} ${PASS}
|
|
assembleGCC ${ARCH} ${PASS} ${LOG} "${AFILES[@]}"
|
|
unSetCompiler
|
|
}
|
|
|
|
|
|
function buildJoeyLib() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
|
|
export CFLAGS="-Dmain=SDL_main -Wall -static-libgcc -I${G_SRC} -I${G_INSTALLED}/include -c"
|
|
export LDFLAGS="-mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid"
|
|
|
|
if [[ "${PASS}" == "debug" ]]; then
|
|
export CFLAGS="-DJOEY_DEBUG ${CFLAGS}"
|
|
fi
|
|
|
|
setCompiler ${ARCH} ${PASS}
|
|
buildJoeyLibSDL2 ${PASS}
|
|
unSetCompiler
|
|
}
|
|
|
|
|
|
function compile() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
local LOG=$3
|
|
local CFILES=(${*:4})
|
|
|
|
export CFLAGS="-Dmain=SDL_main -Wall -static-libgcc"
|
|
|
|
setCompiler ${ARCH} ${PASS}
|
|
compileGCC ${ARCH} ${PASS} ${LOG} "${CFILES[@]}"
|
|
unSetCompiler
|
|
}
|
|
|
|
function enabled() {
|
|
echo 1
|
|
}
|
|
|
|
|
|
function friendlyName() {
|
|
echo "Windows XP+"
|
|
}
|
|
|
|
|
|
function install() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
|
|
# Do not call setCompiler here!
|
|
buildSDL2 ${M_SDL2_TAG} "${ARCH}-w64-mingw32"
|
|
}
|
|
|
|
|
|
function link() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
local LOG=$3
|
|
local OFILES=(${*:4})
|
|
|
|
export CFLAGS="-Dmain=SDL_main -Wall -static-libgcc"
|
|
export LDFLAGS="-mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid"
|
|
|
|
setCompiler ${ARCH} ${PASS}
|
|
linkGCC Windows ${ARCH} ${PASS} ".exe" "-lmingw32" ${LOG} "${OFILES[@]}"
|
|
unSetCompiler
|
|
}
|
|
|
|
|
|
function package() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
local LOG=$3
|
|
local DFILES=(${*:4})
|
|
|
|
packageGCC Windows ${ARCH} ${PASS} ${LOG} "${DFILES[@]}"
|
|
}
|
|
|
|
|
|
function setCompiler() {
|
|
local ARCH=$1
|
|
local PASS=$2
|
|
|
|
M_TRIPLE="${ARCH}-w64-mingw32"
|
|
|
|
export CC=${M_TRIPLE}-gcc
|
|
export LD=${M_TRIPLE}-gcc
|
|
export AR=${M_TRIPLE}-ar
|
|
}
|
|
|
|
|
|
function unSetCompiler() {
|
|
export CC=
|
|
export LD=
|
|
export AR=
|
|
|
|
export LDFLAGS=
|
|
export CFLAGS=
|
|
}
|