diff options
author | saurabhb17 | 2020-02-26 16:37:17 +0530 |
---|---|---|
committer | GitHub | 2020-02-26 16:37:17 +0530 |
commit | 07a8c86216b6b1f694b136ec64c281d62941952e (patch) | |
tree | ad18839d8b4eb1f13419d07878cc4ec4c9b70032 /scripts/osx_build_wx.sh | |
parent | e255d0622297488c1c52755be670733418c994cf (diff) | |
parent | 1fa449fed953fa11f6bd0ea82cc2d3b115ee0781 (diff) | |
download | KiCad-eSim-07a8c86216b6b1f694b136ec64c281d62941952e.tar.gz KiCad-eSim-07a8c86216b6b1f694b136ec64c281d62941952e.tar.bz2 KiCad-eSim-07a8c86216b6b1f694b136ec64c281d62941952e.zip |
Merge pull request #2 from saurabhb17/develop
Remaining files transfered
Diffstat (limited to 'scripts/osx_build_wx.sh')
-rwxr-xr-x | scripts/osx_build_wx.sh | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/scripts/osx_build_wx.sh b/scripts/osx_build_wx.sh new file mode 100755 index 0000000..d803d4c --- /dev/null +++ b/scripts/osx_build_wx.sh @@ -0,0 +1,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!" + + |