Skip to content

Instantly share code, notes, and snippets.

@danngreen
Created August 14, 2017 16:44
Show Gist options
  • Save danngreen/19d641fd6d7d6ab01d63583dc62bfaa1 to your computer and use it in GitHub Desktop.
Save danngreen/19d641fd6d7d6ab01d63583dc62bfaa1 to your computer and use it in GitHub Desktop.
Compiling KiCAD on OSX
Kicad Building:
First, clone the repo:
$ git clone https://github.com/wayneandlayne/KiCadMacOSPackaging.git
Then
modify compile_kicad.py (set the correct location of OCE.framework-- the origin/master assumes your OSX username is `kicad`)
modify compile_wx.sh (reduce # of cores to 3, add some patches and disable mediactrl),
modify setup.sh (make it install bison, oce, and gettext)
Here's the patch to do all that:
(hint: copy this into file and run `git am patchfilename`)
From 15abb6ad50c8bc9f7061c34182e49c9b093cff47 Mon Sep 17 00:00:00 2001
From: danngreen <[email protected]>
Date: Mon, 14 Aug 2017 09:12:55 -0700
Subject: [PATCH] got to compile on dg imac
---
compile_kicad.py | 2 +-
compile_wx.sh | 6 +++++-
setup.sh | 5 +++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/compile_kicad.py b/compile_kicad.py
index 6b31e71..2dd0600 100755
--- a/compile_kicad.py
+++ b/compile_kicad.py
@@ -28,7 +28,7 @@ CMAKE_SETTINGS = ["-DDEFAULT_INSTALL_PATH=/Library/Application Support/kicad",
"-DPYTHON_EXECUTABLE=" + which("python"),
"-DPYTHON_SITE_PACKAGE_PATH=" + os.path.realpath("wx/wx-bin/lib/python2.7/site-packages"),
"-DKICAD_USE_OCE=ON",
- "-DOCE_DIR=/Users/kicad/homebrew/opt/oce/OCE.framework/Versions/0.17/Resources/",
+ "-DOCE_DIR=/usr/local/opt/oce/OCE.framework/Versions/0.18/Resources/",
"-DKICAD_SPICE=ON",
"-DKICAD_REPO_NAME=maser-c4osx",
"-DCMAKE_INSTALL_PREFIX=../bin",
diff --git a/compile_wx.sh b/compile_wx.sh
index 6d41e98..cdf4a71 100755
--- a/compile_wx.sh
+++ b/compile_wx.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-NUM_OF_CORES=7
+NUM_OF_CORES=3
WX_SRC_URL="http://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2?r=http%3A%2F%2Fwww.wxpython.org%2Fdownload.php&ts=1425049283&use_mirror=iweb"
WX_SRC_NAME=wxPython-src-3.0.2.0.tar.bz2
@@ -45,6 +45,9 @@ check_wx_patched() {
patch -p0 < ../../wx_patches/wxwidgets-3.0.0_macosx_scrolledwindow.patch || exit 1
patch -p0 < ../../wx_patches/wxwidgets-3.0.2_macosx_retina_opengl.patch || exit 1
patch -p0 < ../../wx_patches/wxwidgets-3.0.2_macosx_magnify_event.patch || exit 1
+ patch -p0 < ../../kicad/patches/wxwidgets-3.0.2_macosx_sierra.patch || exit 1
+ patch -p0 < ../../kicad/patches/wxwidgets-3.0.2_macosx_data_view_ctrl.patch || exit 1
+ patch -p0 < ../../kicad/patches/wxwidgets-3.0.2_macosx_unicode_pasteboard.patch || exit 1
cd -
fi
}
@@ -74,6 +77,7 @@ check_wx_build() {
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
+ --disable-mediactrl \
--with-expat=builtin \
--without-liblzma \
--with-macosx-version-min=10.9 \
diff --git a/setup.sh b/setup.sh
index 06cbd40..e408fec 100755
--- a/setup.sh
+++ b/setup.sh
@@ -24,8 +24,9 @@ check_brew() {
check_brew_depends() {
echo "Installing dependencies."
check_brew
- if ! brew list gettext cmake doxygen wget glew cairo openssl > /dev/null; then
- brew install --build-bottle gettext swig pixman cmake doxygen wget glew cairo openssl #build-bottle is so it builds for the oldest mac CPU supported by homebrew, which is probably ok for us
+ if ! brew list gettext cmake doxygen wget glew cairo openssl bison oce > /dev/null; then
+ brew install --build-bottle gettext swig pixman cmake doxygen wget glew cairo openssl bison oce
+ #build-bottle is so it builds for the oldest mac CPU supported by homebrew, which is probably ok for us
# You also need git, but if you have brew, you have git.
fi
--
2.11.0
If for some reason the brew patch didn't work, run this:
$ brew install bison oce gettext
$ brew link --force gettext
Now install libngspice_so.sh
$ wget https://orson.net.pl/pub/libngspice/get_libngspice_so.sh
$ chmod +x get_libngspice_so.sh
$ ./get_libngspice_so.sh
$ sudo ./get_libngspice_so.sh install
Now for the MacOSX SDK version dance... ;)
On my laptop (but not my desktop) I had to change line in compile_kicad.py to:
"-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk",
But on my desktop, I was able to create an alias of the 10.12 SDK and name it MacOSX10.9.sdk
At this point you should be able to run:
$ ./all.sh
and 30 minutes later you have kicad!
./all.sh
@danngreen
Copy link
Author

If you get an error "fatal: refusing to merge unrelated histories" in install_libraries.sh (git can't merge a library repo), manually delete the repo folder:
$ rm -rf ./libraries/github/library-repos/discret.pretty [or whatever the folder was]

Then continue running all.sh from the library install:
$ ./install_libraries.sh
$ ./update_install_translations.sh
$ ./package_kicad.sh
$ ./package_extras.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment