-
Notifications
You must be signed in to change notification settings - Fork 0
/
setenv-mingw-xbuild.sh
126 lines (109 loc) · 2.78 KB
/
setenv-mingw-xbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh -e
#
# set environment variables for mingw/mxe cross-build
#
# Usage:
#
# source ./scripts/setenv-mingw-xbuild.sh # 32 bit build
# source ./scripts/setenv-mingw-xbuild.sh shared # 32 bit build, shared libs
# source ./scripts/setenv-mingw-xbuild.sh 64 # 64 bit build
# source ./scripts/setenv-mingw-xbuild.sh 64 shared # 64 bit build, shared libs
# source ./scripts/setenv-mingw-xbuild.sh clean # Clean up exported variables
# source ./scripts/setenv-mingw-xbuild.sh qt5 # use qt5 (experimental)
#
# Prerequisites:
#
# Please see http://mxe.cc/#requirements
#
# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
#
OPENSCADDIR=$PWD
if [ ! $BASEDIR ]; then
BASEDIR=$HOME/openscad_deps
fi
MXELIBTYPE=static
if [ "`echo $* | grep shared `" ]; then
MXELIBTYPE=shared
fi
DEPLOYDIR64=$OPENSCADDIR/mingw64.$MXELIBTYPE
DEPLOYDIR32=$OPENSCADDIR/mingw32.$MXELIBTYPE
if [ ! $DEPLOYDIR ]; then
if [ "`echo $* | grep 64 `" ]; then
DEPLOYDIR=$DEPLOYDIR64
else
DEPLOYDIR=$DEPLOYDIR32
fi
fi
if [ ! $MXEDIR ]; then
if [ "`echo $* | grep 64 `" ]; then
MXEDIR=$BASEDIR/mxe
else
MXEDIR=$BASEDIR/mxe
fi
if [ ! -e $MXEDIR ]; then
if [ -e /opt/mxe ]; then
MXEDIR=/opt/mxe
fi
fi
fi
if [ ! $MXEQTSUBDIR ]; then
if [ "`echo $* | grep qt4 `" ]; then
# qt4 is just 'qt' in MXE, see http://mxe.cc
MXEQTSUBDIR=qt
else
# default is qt5 see issue #252
MXEQTSUBDIR=qt5
fi
fi
if [ ! -e $DEPLOYDIR ]; then
mkdir -p $DEPLOYDIR
fi
if [ "`echo $* | grep 64 `" ]; then
MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32.$MXELIBTYPE
else
MXETARGETDIR=$MXEDIR/usr/i686-w64-mingw32.$MXELIBTYPE
fi
if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then
MINGWX_SAVED_ORIGINAL_PATH=$PATH
echo current path saved
fi
PATH=$MXEDIR/usr/bin:$PATH
PATH=$MXETARGETDIR/$MXEQTSUBDIR/bin:$PATH
OPENSCAD_LIBRARIES=$MXETARGETDIR
if [ "`echo $* | grep clean`" ]; then
OPENSCAD_LIBRARIES=
BASEDIR=
MXEDIR=
MXETARGETDIR=
DEPLOYDIR=
PATH=$MINGWX_SAVED_ORIGINAL_PATH
MINGWX_SAVED_ORIGINAL_PATH=
MXEQTSUBDIR=
else
echo 'linking' $MXETARGETDIR
echo ' to' $DEPLOYDIR/mingw-cross-env
rm -f $DEPLOYDIR/mingw-cross-env
ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env
fi
export OPENSCAD_LIBRARIES
export BASEDIR
export MXEDIR
export MXETARGETDIR
export MXELIBTYPE
export DEPLOYDIR
export PATH
export MINGWX_SAVED_ORIGINAL_PATH
export MXEQTSUBDIR
echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES
echo BASEDIR: $BASEDIR
echo MXEDIR: $MXEDIR
echo MXETARGETDIR: $MXETARGETDIR
echo MXELIBTYPE: $MXELIBTYPE
echo DEPLOYDIR: $DEPLOYDIR
echo MXEQTSUBDIR: $MXEQTSUBDIR
if [ "`echo $* | grep clean`" ]; then
echo PATH restored to pre-setenv-mingw-x state
else
echo PATH modified: $MXEDIR/usr/bin
echo PATH modified: $MXETARGETDIR/$MXEQTSUBDIR/bin
fi