joeybuild/targets/Windows.target

96 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.
#
M_SDL2_TAG=97a5e744497ff7cc93edc5119d67cad3ee86dd57
M_TRIPLE=
source helpers/SDL2.helper
function architectures() {
echo "i686 x86_64"
}
function buildApplication() {
local ARCH=$1
local PASS=$2
# LDFIRST="-lmingw32"
true
}
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 ${M_TRIPLE}
unSetCompiler
}
function enabled() {
echo 1
}
function install() {
local ARCH=$1
local PASS=$2
# Do not call setCompiler here!
buildSDL2 ${M_SDL2_TAG} "${ARCH}-w64-mingw32"
}
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=
}