mirror of
https://github.com/notwa/rc
synced 2024-11-05 02:59:03 -08:00
new mingw toolchain and fixes
This commit is contained in:
parent
1354ec13b2
commit
879226342e
1 changed files with 24 additions and 11 deletions
|
@ -1,14 +1,9 @@
|
|||
# FYI you use /opt/mingw-w64 for mingw itself
|
||||
# but /opt/mingw for things built with mingw...
|
||||
#[ -d "$HOME/opt/mingw-w64" ] || echo -E "crap no mingw" >&2
|
||||
|
||||
mkdir -p ~/opt/mingw
|
||||
alias cmakem='cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=~/mingw.cmake'
|
||||
|
||||
_mw_enabled=0
|
||||
_mw_name=i686-w64-mingw32
|
||||
_mw_bin=~/opt/mingw-w64/bin/$_mw_name
|
||||
_mw_misc=~/opt/mingw-w64/$_mw_name
|
||||
_mw_host=x86_64-w64-mingw32
|
||||
_mw_bin=~/src/mxe/usr/bin
|
||||
_mw_misc=~/src/mxe/usr/$_mw_host
|
||||
_mw_prefix=~/opt/mingw
|
||||
|
||||
declare -A _mw_
|
||||
|
@ -24,7 +19,7 @@ mingw-disable() {
|
|||
_mw_enabled=0
|
||||
|
||||
local e=
|
||||
for e in PATH AR CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS RANLIB RC WINDRES; do
|
||||
for e in PATH PREFIX AR CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS RANLIB RC WINDRES; do
|
||||
export "$e=${_mw_[$e]}"
|
||||
done
|
||||
}
|
||||
|
@ -34,13 +29,31 @@ mingw-enable() {
|
|||
_mw_enabled=1
|
||||
|
||||
set -- CC gcc CXX g++ CPP cpp AR ar RANLIB ranlib RC windres WINDRES windres
|
||||
while _mw_export "$1" "$_mw_bin-$2"; do
|
||||
while _mw_export "$1" "$_mw_bin/$_mw_host-$2"; do
|
||||
shift 2
|
||||
done
|
||||
|
||||
_mw_export PATH "$PATH:$HOME/opt/mingw-w64/bin"
|
||||
_mw_export PATH "$PATH:$_mw_bin"
|
||||
_mw_export PREFIX "$_mw_prefix"
|
||||
_mw_export CFLAGS "-O2 -I $_mw_misc/include -I $_mw_prefix/include"
|
||||
_mw_export LDFLAGS "-s -L $_mw_misc/lib -L $_mw_prefix/lib"
|
||||
_mw_export CPPFLAGS ''
|
||||
_mw_export CXXFLAGS "$CFLAGS"
|
||||
}
|
||||
|
||||
mw() {
|
||||
[ "$#" -eq 1 ] && {
|
||||
if [ "$1" -eq 1 ]
|
||||
then; mingw-enable
|
||||
else; mingw-disable
|
||||
fi
|
||||
} || {
|
||||
[ $_mw_enabled -eq 0 ] && {
|
||||
echo "mingw enabled"
|
||||
mingw-enable
|
||||
} || {
|
||||
echo "mingw disabled"
|
||||
mingw-disable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue