blob: d803d4c1553230f2f27f52011709a1d7dfdf1c5c (
plain)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
#!/bin/bash
#
# Small helper script for patching/compiling wxWidgets/wxPython on OSX
#
# Params
# $1 wxWidgets/wxPython source folder (relative to current dir)
# $2 Target bin folder
# $3 KiCad source folder (relative to current dir)
# $4 OSX target version (e.g., "10.8")
# $5 Extra make options (e.g., "-j4")
createPaths() {
echo "*** Creating/wiping build and bin folder..."
rm -rf wx-build
rm -rf $1
mkdir wx-build
mkdir $1
}
doPatch() {
cwd=$(pwd)
cd $1
patchcmd="patch -p0 -RN --dry-run < $cwd/$2"
eval $patchcmd &> /dev/null
if [ $? -eq 0 ];
then
echo "*** Patch '$2' already applied, skipping..."
else
echo "*** Applying patch '$2'..."
patch -p0 < $cwd/$2
if [ $? -ne 0 ];
then
cd $cwd
exit 1
fi
fi
cd $cwd
}
wxWidgets_configure() {
echo "*** Configuring wxWidgets..."
cwd=$(pwd)
cd wx-build
../$1/configure \
--prefix=$cwd/$2 \
--with-opengl \
--enable-aui \
--enable-utf8 \
--enable-html \
--enable-stl \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--without-liblzma \
--with-macosx-version-min=$3 \
--enable-universal-binary=i386,x86_64 \
CC=clang \
CXX=clang++
if [ $? -ne 0 ];
then
cd ..
exit 1
fi
cd ..
}
wxWidgets_buildInst() {
echo "*** Building wxWidgets..."
cd wx-build
make $1 install
if [ $? -ne 0 ];
then
cd ..
exit 1
fi
cd ..
}
wxPython_buildInst() {
cwd=$(pwd)
cd $1/wxPython
# build params
WXPYTHON_BUILD_OPTS="WX_CONFIG=$cwd/$2/bin/wx-config \
BUILD_BASE=$cwd/wx-build \
UNICODE=1 \
WXPORT=osx_cocoa"
# build
python setup.py build_ext $WXPYTHON_BUILD_OPTS
if [ $? -ne 0 ];
then
cd $cwd
exit 1
fi
# install
python setup.py install --prefix=$cwd/$2 $WXPYTHON_BUILD_OPTS
if [ $? -ne 0 ];
then
cd $cwd
exit 1
fi
cd $cwd
}
# check parameters
if [ "$#" -lt 4 ];
then
echo "OSX wxWidgets/wxPython build script"
echo
echo "Usage:"
echo " osx_build_wx.sh <src> <bin> <kicad> <osxtarget> [makeopts]"
echo " <src> wxWidgets/wxPython source folder"
echo " <bin> Destination folder"
echo " <kicad> KiCad folder"
echo " <osxtarget> OSX target (e.g., 10.7)"
echo " [makeopts] Optional: make options for building wxWidgets (e.g., -j4)"
exit 1
fi
# create build paths
createPaths "$2"
# patch wxWidgets sources
echo "*** Patching wxWidgets..."
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx.patch"
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_bug_15908.patch"
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_soname.patch"
# high resolution in OpenGL canvas: http://trac.wxwidgets.org/ticket/15700
doPatch "$1" "$3/patches/wxwidgets-3.0.2_macosx_retina_opengl.patch"
# patch to support pinch-to-zoom on trackpads
doPatch "$1" "$3/patches/wxwidgets-3.0.2_macosx_magnify_event.patch"
# configure and build wxWidgets
wxWidgets_configure "$1" "$2" "$4"
wxWidgets_buildInst "$5"
# check if source is wxPython
if [ -d $1/wxPython ];
then
echo "*** Source is wxPython, now building wxPython stuff..."
wxPython_buildInst "$1" "$2"
fi
# remove build dir
echo "*** Removing build folder"
rm -rf wx-build
# done
echo "*** Finished building!"
|