chiark / gitweb /
ff7a6c38442a187f71a86413a283f17e9c3d6cf6
[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 Debian and Ubuntu Linux
20 --------
21
22 To build and install Cura, run the following commands:
23
24 ```bash
25 git clone https://github.com/daid/Cura.git
26
27 sudo apt-get install python-opengl
28 sudo apt-get install python-numpy
29 sudo apt-get install python-serial
30 sudo apt-get install python-setuptools
31
32 cd Cura
33
34 sudo ./package.sh debian
35
36 sudo dpkg -i ./scripts/linux/Cura*.deb
37 ```
38
39 Mac OS X
40 --------
41 The following section describes how to prepare working environment for developing and packaing for Mac OS X.
42 The working environment consist of build of Python, build of wxPython and all required Python packages.
43
44 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.
45
46
47 ###Install Python
48 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7
49
50 **non-system**: Output of  
51 `python -c "import sys; print sys.prefix"`  
52 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.
53
54 **framework-based**: Output of  
55 `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`  
56 should be non-empty string. E.g. *Python*.
57
58 **universal**: Output of  
59 ``lipo -info `which python` ``  
60 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.
61
62 **deployment target set to 10.6**: Output of  
63 ``otool -l `which python` ``  
64 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.
65
66 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:  
67 `brew install --build-bottle --fresh Cura/scripts/darwin/python.rb --universal`  
68 Note if you already have Python installed via Homebrew, you have to uninstall it first.
69
70 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).
71
72
73 ###Configure Virtualenv
74 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:  
75 `mkvirtualenv Cura`
76
77 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.
78
79 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/*:
80
81 1. `cd` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:
82
83         ./configure \
84         CFLAGS='-msse2 -mno-sse3 -mno-sse4' \
85         CXXFLAGS='-msse2 -mno-sse3 -mno-sse4' \
86         --disable-debug \
87         --enable-clipboard \
88         --enable-display \
89         --enable-dnd \
90         --enable-monolithic \
91         --enable-optimise \
92         --enable-std_string \
93         --enable-svg \
94         --enable-unicode \
95         --enable-universal_binary=i386,x86_64 \
96         --enable-webkit \
97         --prefix=$HOME/.virtualenvs/Cura/ \
98         --with-expat \
99         --with-libjpeg=builtin \
100         --with-libpng=builtin \
101         --with-libtiff=builtin \
102         --with-macosx-version-min=10.6 \
103         --with-opengl \
104         --with-osx_cocoa \
105         --with-zlib=builtin
106
107 2. `make install`  
108     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:  
109     `make -j4 install`
110 3. `cd` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*
111 4. Build wxPython (Note `python` is the python of your virtualenv):
112
113         python setup.py build_ext \
114         BUILD_GIZMOS=1 \
115         BUILD_GLCANVAS=1 \
116         BUILD_STC=1 \
117         INSTALL_MULTIVERSION=0 \
118         UNICODE=1 \
119         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
120         WXPORT=osx_cocoa
121
122 5. Install wxPython (Note `python` is the python of your virtualenv):
123
124         python setup.py install \
125         --prefix=$HOME/.virtualenvs/Cura \
126         BUILD_GIZMOS=1 \
127         BUILD_GLCANVAS=1 \
128         BUILD_STC=1 \
129         INSTALL_MULTIVERSION=0 \
130         UNICODE=1 \
131         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \
132         WXPORT=osx_cocoa
133
134 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:
135
136         #!/bin/bash
137         ENV=`python -c "import sys; print sys.prefix"`
138         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python
139         export PYTHONHOME=$ENV
140         exec $PYTHON "$@"
141
142 At this point virtualenv is configured for wxPython development.  
143 Remember to use `python` for pacakging and `pythonw` to run app for debugging.
144
145
146 ###Install Python Packages
147 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*  
148 If you use virtualenv, installing requirements as easy as `pip install -r requirements_darwin.txt`
149
150
151 ###Package Cura into application
152 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:  
153 `./package.sh darwin`
154
155 Note that application is only guaranteed to work on Mac OS X version used to build and higher, but may not support lower versions.
156 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.
157