chiark / gitweb /
package.sh: add fedora
[cura.git] / README.md
1 Cura\r
2 ====\r
3 \r
4 Read this, it's important!\r
5 ===========================\r
6 \r
7 If you are reading this, then you are looking at the *development* version of Cura. If you just want to use Cura, take a look at the following location: https://daid.github.com/Cura\r
8 \r
9 Development\r
10 ===========\r
11 \r
12 Cura is developed in Python with a C++ engine. The part you are looking at right now is the Python GUI.\r
13 The C++ engine is responsible for generating the actual toolpath. For development of the engine check out https://github.com/Ultimaker/CuraEngine\r
14 \r
15 Issues\r
16 ===========\r
17 \r
18 Before posting issues (either Bugs, Feature requests or Requests for information) please read our policies carefully. These will be regulary updated and can be found at https://github.com/daid/Cura/wiki/Issue-policies\r
19 \r
20 \r
21 Packaging\r
22 ---------\r
23 \r
24 Cura development comes with a script "package.sh", this script has been designed to run under *nix OSes (Linux, MacOS, FreeBSD). For Windows the package.sh script can be run from bash using git.\r
25 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.\r
26 \r
27 Both MacOS and Linux require some extra instructions for development, as you need to prepare an environment. Look below at the proper section to see what is needed.\r
28 \r
29 Fedora\r
30 --------\r
31 \r
32 Fedora builds Cura by using ```mock```, thereby enabling it to build RPMs for\r
33 every distribution that ```mock``` has a configuration file for. In pratice\r
34 this means that Fedora can build RPMs for several versions of Fedora, CentOS\r
35 and RHEL.\r
36 \r
37 Cura can be built under a regular user account, there is no need to have root\r
38 privileges. In fact, having root privileges is very much discouraged.\r
39 \r
40 However, the user account under which the build is performed needs to be a\r
41 member of the 'mock' group. This is accomplished as follows:\r
42 \r
43 ```bash\r
44 sudo usermod -a -G mock "$(whoami)"\r
45 ```\r
46 \r
47 To install the software that is required to build Cura, run the following\r
48 commands:\r
49 \r
50 ```bash\r
51 sudo yum install -y git rpmdevtools rpm-build mock arduino\r
52 \r
53 # Ensure that the Arduino tools can be found by the build\r
54 sudo mkdir -p /usr/share/arduino/hardware/tools/avr\r
55 sudo ln -sf /usr/bin /usr/share/arduino/hardware/tools/avr/bin\r
56 \r
57 ```\r
58 \r
59 To build and install Cura, run the following commands:\r
60 \r
61 ```bash\r
62 # Get the Cura software, only required once\r
63 git clone https://github.com/daid/Cura.git Cura\r
64 \r
65 # Build for the current system\r
66 cd Cura\r
67 ./package.sh fedora\r
68 \r
69 # Install on the current system\r
70 sudo yum localinstall -y scripts/linux/fedora/RPMS/Cura-*.rpm\r
71 ```\r
72 \r
73 Examples of building other configurations:\r
74 \r
75 ```bash\r
76 # Build for Fedora rawhide x86-64 and i386\r
77 ./package.sh fedora fedora-rawhide-x86_64.cfg fedora-rawhide-i386.cfg\r
78 \r
79 # Since only the basename of the mock configurations is used, this also works:\r
80 ./package.sh fedora /etc/mock/fedora-21-x86_64.cfg /etc/mock/fedora-rawhide-i386.cfg\r
81 ```\r
82 \r
83 Debian and Ubuntu Linux\r
84 --------\r
85 \r
86 To build and install Cura, run the following commands:\r
87 \r
88 ```bash\r
89 git clone https://github.com/daid/Cura.git\r
90 \r
91 sudo apt-get install python-opengl\r
92 sudo apt-get install python-numpy\r
93 sudo apt-get install python-serial\r
94 sudo apt-get install python-setuptools\r
95 sudo apt-get install curl\r
96 \r
97 cd Cura\r
98 \r
99 sudo ./package.sh debian_amd64          # or debian_i386 for 32bit\r
100 \r
101 sudo dpkg -i ./scripts/linux/cura*.deb\r
102 ```\r
103 \r
104 Mac OS X\r
105 --------\r
106 The following section describes how to prepare working environment for developing and packaing for Mac OS X.\r
107 The working environment consist of build of Python, build of wxPython and all required Python packages.\r
108 \r
109 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.\r
110 \r
111 \r
112 ###Install Python\r
113 You'll need **non-system**, **framework-based**, **universal** with **deployment target set to 10.6** build of Python 2.7\r
114 \r
115 **non-system**: Output of\r
116 `python -c "import sys; print sys.prefix"`\r
117 should *not* start with *"/System/Library/Frameworks/Python.framework/"*.\r
118 \r
119 **framework-based**: Output of\r
120 `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`\r
121 should be non-empty string. E.g. *Python*.\r
122 \r
123 **universal**: Output of\r
124 ``lipo -info `which python` ``\r
125 should include both i386 and x86_64. E.g *"Architectures in the fat file: /usr/local/bin/python are: i386 x86_64"*.\r
126 \r
127 **deployment target set to 10.6**: Output of\r
128 ``otool -l `which python` ``\r
129 should contain *"cmd LC_VERSION_MIN_MACOSX ... version 10.6"*.\r
130 \r
131 The easiest way to install it is via [Homebrew](http://mxcl.github.com/homebrew/) using the formula from Cura's repo:\r
132 `brew install --build-bottle --fresh Cura/scripts/darwin/python.rb --universal`\r
133 Note if you already have Python installed via Homebrew, you have to uninstall it first.\r
134 \r
135 You can also install [official build](http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg).\r
136 \r
137 \r
138 FreeBSD\r
139 --------\r
140 On FreeBSD simply use the Port Tree (`cd /usr/ports/cad/cura`) to create (`make package`) and install (`make install`) the package as root. Port will check for all necessary dependencies. You can also use the provided binary package with `pkg install Cura`.\r
141 \r
142 If you want to create an archive for local use the `package.sh freebsd` script (as an ordinary user) will give you a tarball with the program.\r
143 \r
144 \r
145 ###Configure Virtualenv\r
146 Create new virtualenv. If you have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) installed:\r
147 `mkvirtualenv Cura`\r
148 \r
149 wxPython cannot be installed via pip, we have to build it from source by specifing prefix to our virtualenv.\r
150 \r
151 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/*:\r
152 \r
153 1. `cd` into *~/Downloads/wxPython-src-2.9.4.0/* and configure the sources:\r
154 \r
155         ./configure \\r
156         CFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
157         CXXFLAGS='-msse2 -mno-sse3 -mno-sse4' \\r
158         --disable-debug \\r
159         --enable-clipboard \\r
160         --enable-display \\r
161         --enable-dnd \\r
162         --enable-monolithic \\r
163         --enable-optimise \\r
164         --enable-std_string \\r
165         --enable-svg \\r
166         --enable-unicode \\r
167         --enable-universal_binary=i386,x86_64 \\r
168         --enable-webkit \\r
169         --prefix=$HOME/.virtualenvs/Cura/ \\r
170         --with-expat \\r
171         --with-libjpeg=builtin \\r
172         --with-libpng=builtin \\r
173         --with-libtiff=builtin \\r
174         --with-macosx-version-min=10.6 \\r
175         --with-opengl \\r
176         --with-osx_cocoa \\r
177         --with-zlib=builtin\r
178 \r
179 2. `make install`\r
180     Note to speedup the process I recommend you to enable multicore build by adding the -j*cores* flag:\r
181     `make -j4 install`\r
182 3. `cd` into *~/Downloads/wxPython-src-2.9.4.0/wxPython/*\r
183 4. Build wxPython (Note `python` is the python of your virtualenv):\r
184 \r
185         python setup.py build_ext \\r
186         BUILD_GIZMOS=1 \\r
187         BUILD_GLCANVAS=1 \\r
188         BUILD_STC=1 \\r
189         INSTALL_MULTIVERSION=0 \\r
190         UNICODE=1 \\r
191         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
192         WXPORT=osx_cocoa\r
193 \r
194 5. Install wxPython (Note `python` is the python of your virtualenv):\r
195 \r
196         python setup.py install \\r
197         --prefix=$HOME/.virtualenvs/Cura \\r
198         BUILD_GIZMOS=1 \\r
199         BUILD_GLCANVAS=1 \\r
200         BUILD_STC=1 \\r
201         INSTALL_MULTIVERSION=0 \\r
202         UNICODE=1 \\r
203         WX_CONFIG=$HOME/.virtualenvs/Cura/bin/wx-config \\r
204         WXPORT=osx_cocoa\r
205 \r
206 6. Create file *~/.virtualenvs/Cura/bin/pythonw* with the following content:\r
207 \r
208         #!/bin/bash\r
209         ENV=`python -c "import sys; print sys.prefix"`\r
210         PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python\r
211         export PYTHONHOME=$ENV\r
212         exec $PYTHON "$@"\r
213 \r
214 At this point virtualenv is configured for wxPython development.\r
215 Remember to use `python` for pacakging and `pythonw` to run app for debugging.\r
216 \r
217 \r
218 ###Install Python Packages\r
219 Required python packages are specified in *requirements.txt* and *requirements_darwin.txt*\r
220 If you use virtualenv, installing requirements as easy as `pip install -r requirements_darwin.txt`\r
221 \r
222 \r
223 ###Package Cura into application\r
224 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:\r
225 `./package.sh darwin`\r
226 \r
227 Note that application is only guaranteed to work on Mac OS X version used to build and higher, but may not support lower versions.\r
228 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.\r
229 \r