chiark / gitweb /
b314169100bbcc469e97c81a8c0b470ac3fd4fbb
[cura.git] / README.md
1 Cura
2 ====
3
4 If you are reading this, then you are looking at the *development* version of Cura. If you just want to use Cura look at the following location: https://github.com/daid/Cura/wiki
5
6 Development
7 ===========
8
9 Cura is developed in Python. Getting Cura up and running for development is not very difficult. If you copy the python and pypy from a release into your Cura development checkout then you can use Cura right away, just like you would with a release.
10 For development with git, check the help on github. Pull requests is the fastest way to get changes into Cura.
11
12
13 Packaging
14 ---------
15
16 Cura development comes with a script "package.sh", this script has been designed to run under unix like OSes (Linux, MacOS). Running it from sygwin is not a priority.
17 The "package.sh" script generates a final release package. You should not need it during development, unless you are changing the release process. If you want to distribute your own version of Cura, then the package.sh script will allow you to do that.
18
19
20 Mac OS X
21 --------
22 The following section describes how to prepare working environment for developing and packaing for Mac OS X.
23 The working environment consist of build of Python, build of wxPython and all required Python packages.
24
25 We assume you already have Apple hardware with [64bit processor](http://support.apple.com/kb/HT3696) and you are familiar with tools like [virtualenv](http://pypi.python.org/pypi/virtualenv), [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) and [pip](http://www.pip-installer.org/en/latest/). Also ensure you have modern compiler installed.
26
27
28 ###Install Python
29 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7
30
31 **non-system**: Output of  
32 `python -c "import sys; print sys.prefix"`  
33 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.
34
35 **framework-based**: Output of  
36 `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`  
37 should be non-empty string. E.g. *Python*.
38
39 **universal**: Output of  
40 ``lipo -info `which python` ``  
41 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.
42
43 **deployment target set to 10.6**: Output of  
44 ``otool -l `which python` ``  
45 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.
46
47 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:  
48 `brew install --fresh Cura/scripts/darwin/python.rb --universal`  
49 Note if you already have Python installed via Homebrew, you have to uninstall it first.
50
51 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).
52
53
54 ###Configure Virtualenv
55 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:  
56 `mkvirtualenv Cura`
57
58 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.
59
60 Assuming you have virtualenv at *~/.virtualenvs/Cura/* and [wxPython sources](http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2) at *~/Downloads/wxPython-src-2.9.4.0/*:
61
62 1. `cd` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:
63
64         ./configure \
65         --disable-debug \
66         --enable-clipboard \
67         --enable-display \
68         --enable-dnd \
69         --enable-monolithic \
70         --enable-optimise \
71         --enable-std_string \
72         --enable-svg \
73         --enable-unicode \
74         --enable-universal_binary=i386,x86_64 \
75         --enable-webkit \
76         --prefix=$HOME/.virtualenvs/Cura/ \
77         --with-expat \
78         --with-libjpeg=builtin \
79         --with-libpng=builtin \
80         --with-libtiff=builtin \
81         --with-macosx-version-min=10.6 \
82         --with-opengl \
83         --with-osx_cocoa \
84         --with-zlib=builtin
85
86 2. `make install`  
87     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:  
88     `make -j4 install`
89 3. `cd` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*
90 4. Build wxPython (Note `python` is the python of your virtualenv):
91
92         python setup.py build_ext \
93         BUILD_GIZMOS=1 \
94         BUILD_GLCANVAS=1 \
95         BUILD_STC=1 \
96         INSTALL_MULTIVERSION=0 \
97         UNICODE=1 \
98         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
99         WXPORT=osx_cocoa
100
101 5. Install wxPython (Note `python` is the python of your virtualenv):
102
103         python setup.py install \
104         --prefix=$HOME/.virtualenvs/Cura \
105         BUILD_GIZMOS=1 \
106         BUILD_GLCANVAS=1 \
107         BUILD_STC=1 \
108         INSTALL_MULTIVERSION=0 \
109         UNICODE=1 \
110         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
111         WXPORT=osx_cocoa
112
113 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:
114
115         #!/bin/bash
116         ENV=`python -c "import sys; print sys.prefix"`
117         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python
118         export PYTHONHOME=$ENV
119         exec $PYTHON "$@"
120
121 At this point virtualenv is configured for wxPython development.  
122 Remember to use `python` for pacakging and `pythonw` to run app for debugging.
123
124
125 ###Install Python Packages
126 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*  
127 If you use virtualenv, installing requirements as easy as `pip install -r requirements_darwin.txt`
128
129
130 ###Package Cura into application
131 Ensure that virtualenv is activated, so `python` points to the python of your virtualenv (e.g. ~/.virtualenvs/Cura/bin/python).Use package.sh to build Cura:  
132 `./package.sh darwin`
133
134 Note that application is only guaranteed to work on Mac OS X version used to build and higher, but may not support lower versions.
135 E.g. Cura built on 10.8 will work on 10.8 and 10.7, but not on 10.6. In other hand, Cura built on 10.6 will work on 10.6, 10.7 and 10.8.
136