1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-29 02:17:12 -07:00

mw functionality changes (32bit option)

This commit is contained in:
Connor Olding 2013-11-06 05:03:38 -08:00
parent 8625671b81
commit 748e82ff66

31
sh/mw
View File

@ -2,10 +2,9 @@
mkdir -p ~/opt/mingw mkdir -p ~/opt/mingw
_mw_enabled=0 _mw_enabled=0
_mw_host=x86_64-w64-mingw32 _mw_host32=i686-w64-mingw32
_mw_bin=~/src/mxe/usr/bin _mw_host64=x86_64-w64-mingw32
_mw_misc=~/src/mxe/usr/$_mw_host _mw_host=$_mw_host64
_mw_prefix=~/opt/mingw
typeset -Ag _mw_ # cryptic math expression errors if not global! typeset -Ag _mw_ # cryptic math expression errors if not global!
@ -23,12 +22,18 @@ mingw-disable() {
for e in PATH PREFIX CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS AR RANLIB RC WINDRES SDL_CFLAGS SDL_LDLIBS; do for e in PATH PREFIX CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS AR RANLIB RC WINDRES SDL_CFLAGS SDL_LDLIBS; do
export "$e=${_mw_[$e]}" export "$e=${_mw_[$e]}"
done done
echo "mingw disabled"
} }
mingw-enable() { mingw-enable() {
[ $_mw_enabled -eq 1 ] && return 1 [ $_mw_enabled -eq 1 ] && mingw-disable || true
_mw_enabled=1 _mw_enabled=1
_mw_host=${1:-$_mw_host}
local _mw_misc=~/src/mxe/usr/$_mw_host
local _mw_bin=~/src/mxe/usr/bin
local _mw_prefix=~/opt/mingw
set -- CC gcc CXX g++ CPP cpp AR ar RANLIB ranlib RC windres WINDRES windres set -- CC gcc CXX g++ CPP cpp AR ar RANLIB ranlib RC windres WINDRES windres
while _mw_export "$1" "$_mw_bin/$_mw_host-$2"; do while _mw_export "$1" "$_mw_bin/$_mw_host-$2"; do
shift 2 shift 2
@ -47,21 +52,27 @@ mingw-enable() {
_mw_export SDL_CFLAGS "$($_mw_host-sdl2-config --cflags)" _mw_export SDL_CFLAGS "$($_mw_host-sdl2-config --cflags)"
_mw_export SDL_LDLIBS "$($_mw_host-sdl2-config --libs)" _mw_export SDL_LDLIBS "$($_mw_host-sdl2-config --libs)"
} }
echo "mingw enabled ($_mw_host)"
return 0
} }
mw() { mw() {
if [ "$#" -eq 1 ]; then if [ "$#" -eq 1 ]; then
if [ "$1" -eq 1 ]; then if [ "$1" -eq 32 ]; then
mingw-enable mingw-enable $_mw_host32
else elif [ "$1" -eq 64 ]; then
mingw-enable $_mw_host64
elif [ "$1" -eq 0 ]; then
mingw-disable mingw-disable
else
echo "usage: mw [0/32/64]"
return 1
fi fi
else else
if [ $_mw_enabled -eq 0 ]; then if [ $_mw_enabled -eq 0 ]; then
echo "mingw enabled"
mingw-enable mingw-enable
else else
echo "mingw disabled"
mingw-disable mingw-disable
fi fi
fi fi