-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
mingw-x-build-dependencies.sh
executable file
·99 lines (86 loc) · 2.47 KB
/
mingw-x-build-dependencies.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
#!/bin/sh -e
#
# This script builds all library dependencies of OpenSCAD for cross-compilation
# from linux to mingw32/64 for windows(TM), using the MXE cross build system.
#
# Usage:
# . ./scripts/setenv-mingw-xbuild.sh [64|32] [static|shared]
# ./scripts/mingw-x-build-dependencies.sh
#
# As of 2016 MXE allows these targets with the MXE_TARGETS environment variable.
#
# 64 bit static linked libraries MXE_TARGETS=x86_64-w64-mingw32.static
# 32 bit static linked libraries MXE_TARGETS=i686-w64-mingw32.static
# 64 bit shared libraries MXE_TARGETS=x86_64-w64-mingw32.shared
# 32 bit shared libraries MXE_TARGETS=i686-w64-mingw32.shared
#
# 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
#
# Shout out to Tony Theodore for updating MXE to 64 bit
#
if [ ! "`command -v zip`" ]; then
echo please install zip
exit
fi
if [ ! $NUMCPU ]; then
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
NUMCPU=1
fi
if [ ! $NUMJOBS ]; then
echo "note: you can 'export NUMJOBS=x' for building multiple pkgs at once"
if [ $NUMCPU -gt 2 ]; then
NUMJOBS=$((NUMCPU/2))
else
NUMJOBS=1
fi
fi
if [ ! $OPENSCAD_BUILD_TARGET_OSTYPE ]; then
echo "please run 'source ./scripts/setenv-mingw-xbuild.sh' first"
echo "please check the README.MD"
fi
docmd()
{
echo $*
$*
}
PACKAGES='qtbase qscintilla2 mpfr eigen opencsg cgal'
PACKAGES=$PACKAGES' glib freetype fontconfig harfbuzz libxml2'
if [ "`echo $MXE_TARGET | grep i686`" ]; then
PACKAGES=$PACKAGES' nsis'
fi
mxe_get_debian_binary_deps()
{
debline="deb http://pkg.mxe.cc/repos/apt/debian wheezy main"
echo $debline > /etc/apt/sources.list.d/mxeapt.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D43A795B73B16ABE9643FE1AFD8FFF16DB45C6AB
apt-get update
MXE_PREFIX=`echo $MXE_TARGET | sed -e s/_/-/g`
PKGLIST=
for pkg in $PACKAGES; do
PKGLIST=$PKGLIST' '$MXE_PREFIX'-'$pkg
done
apt-get -y install $PKGLIST
apt-get install nsis
}
mxe_build_from_src()
{
if [ ! $MXE_TARGET ]; then
echo please run '. scripts/setenv-mingw-xbuild.sh'
exit
fi
if [ ! -e $MXEDIR ]; then
mkdir -p $MXEDIR
cd $MXEDIR/..
echo "Downloading MXE into " $PWD
git clone git://github.com/openscad/mxe.git $MXEDIR
fi
docmd cd $MXEDIR
docmd git checkout openscad-snapshot-build
docmd make $PACKAGES MXE_TARGETS=$MXE_TARGET -j $NUMCPU JOBS=$NUMJOBS
docmd cd $OPENSCADDIR
}
mxe_get_debian_binary_deps