3 # This script is to package the Cura package for Windows/Linux and Mac OS X
4 # This script should run under Linux and Mac OS X, as well as Windows with Cygwin.
6 #############################
8 #############################
10 ##Select the build target
11 BUILD_TARGET=${1:-none}
14 #BUILD_TARGET=debian_i386
15 #BUILD_TARGET=debian_amd64
16 #BUILD_TARGET=debian_armhf
19 ##Do we need to create the final archive
20 ARCHIVE_FOR_DISTRIBUTION=1
21 ##Which version name are we appending to the final archive
22 export BUILD_NAME=15.01-RC7
23 TARGET_DIR=Cura-${BUILD_NAME}-${BUILD_TARGET}
25 ##Which versions of external programs to use
26 WIN_PORTABLE_PY_VERSION=2.7.2.1
28 ##Which CuraEngine to use
29 if [ -z ${CURA_ENGINE_REPO} ] ; then
30 CURA_ENGINE_REPO="git@github.com:Ultimaker/CuraEngine.git"
33 #############################
35 #############################
38 if [ -z "`which $1`" ]; then
39 echo "The $1 command must be somewhere in your \$PATH."
40 echo "Fix your \$PATH or install $2"
47 filename=`basename "$1"`
48 echo "Checking for $filename"
49 if [ ! -f "$filename" ]; then
53 echo "Failed to download $1"
62 echo "7z x -y $*" >> log.txt
65 echo "Failed to extract $*"
72 echo "Cloning $1 into $2"
84 #############################
86 #############################
87 if [ "$BUILD_TARGET" = "none" ]; then
88 echo "You need to specify a build target with:"
91 echo "$0 debian_amd64"
92 echo "$0 debian_armhf"
98 if [ -z `which make` ]; then
104 # Change working directory to the directory the script is in
105 # http://stackoverflow.com/a/246128
106 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
109 checkTool git "git: http://git-scm.com/"
110 checkTool curl "curl: http://curl.haxx.se/"
111 if [ $BUILD_TARGET = "win32" ]; then
112 checkTool avr-gcc "avr-gcc: http://winavr.sourceforge.net/ "
113 #Check if we have 7zip, needed to extract and packup a bunch of packages for windows.
114 checkTool 7z "7zip: http://www.7-zip.org/"
115 checkTool $MAKE "mingw: http://www.mingw.org/"
117 #For building under MacOS we need gnutar instead of tar
118 if [ -z `which gnutar` ]; then
124 #############################
125 # Build the required firmwares
126 #############################
128 if [ -d "C:/arduino-1.0.3" ]; then
129 ARDUINO_PATH=C:/arduino-1.0.3
131 elif [ -d "/Applications/Arduino.app/Contents/Resources/Java" ]; then
132 ARDUINO_PATH=/Applications/Arduino.app/Contents/Resources/Java
135 ARDUINO_PATH=/usr/share/arduino
139 if [ ! -d "$ARDUINO_PATH" ]; then
140 echo "Arduino path '$ARDUINO_PATH' doesn't exist"
144 #Build the Ultimaker Original firmwares.
145 gitClone git@github.com:Ultimaker/Marlin.git _UltimakerMarlin
146 cd _UltimakerMarlin/Marlin
147 git checkout Marlin_v1
148 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_250000 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_single\"' BAUDRATE=250000 TEMP_SENSOR_1=0 EXTRUDERS=1"
149 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_115200 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_single\"' BAUDRATE=115200 TEMP_SENSOR_1=0 EXTRUDERS=1"
150 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Dual_250000 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_dual\"' BAUDRATE=250000 TEMP_SENSOR_1=-1 EXTRUDERS=2"
151 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Dual_115200 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_dual\"' BAUDRATE=115200 TEMP_SENSOR_1=-1 EXTRUDERS=2"
152 git checkout Marlin_UM_HeatedBedUpgrade
153 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_HBK_250000 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_single_HB\"' BAUDRATE=250000 TEMP_SENSOR_1=0 EXTRUDERS=1"
154 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_HBK_115200 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_single_HB\"' BAUDRATE=115200 TEMP_SENSOR_1=0 EXTRUDERS=1"
155 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_HBK_Dual_250000 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_dual_HB\"' BAUDRATE=250000 TEMP_SENSOR_1=-1 EXTRUDERS=2"
156 $MAKE -j 3 HARDWARE_MOTHERBOARD=7 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_HBK_Dual_115200 DEFINES="'VERSION_BASE=\"Ultimaker:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_dual_HB\"' BAUDRATE=115200 TEMP_SENSOR_1=-1 EXTRUDERS=2"
157 git checkout Marlin_UM_Original_Plus
158 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Plus_250000 DEFINES="'VERSION_BASE=\"Ultimaker+:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_single\"' BAUDRATE=250000 TEMP_SENSOR_1=0 EXTRUDERS=1"
159 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Plus_115200 DEFINES="'VERSION_BASE=\"Ultimaker+:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_single\"' BAUDRATE=115200 TEMP_SENSOR_1=0 EXTRUDERS=1"
160 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Plus_Dual_250000 DEFINES="'VERSION_BASE=\"Ultimaker+:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"250000_dual\"' BAUDRATE=250000 TEMP_SENSOR_1=20 EXTRUDERS=2"
161 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_UltimakerMarlin_Plus_Dual_115200 DEFINES="'VERSION_BASE=\"Ultimaker+:_${BUILD_NAME}\"' 'VERSION_PROFILE=\"115200_dual\"' BAUDRATE=115200 TEMP_SENSOR_1=20 EXTRUDERS=2"
164 gitClone git@github.com:Ultimaker/Ultimaker2Marlin.git _Ultimaker2Marlin
165 cd _Ultimaker2Marlin/Marlin
167 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_Ultimaker2 DEFINES="'STRING_CONFIG_H_AUTHOR=\"Version:_${BUILD_NAME}\"' TEMP_SENSOR_1=0 EXTRUDERS=1"
168 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_Ultimaker2Dual DEFINES="'STRING_CONFIG_H_AUTHOR=\"Version:_${BUILD_NAME}\"' TEMP_SENSOR_1=20 EXTRUDERS=2"
170 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_Ultimaker2go DEFINES="'STRING_CONFIG_H_AUTHOR=\"Version:_${BUILD_NAME}go\"' TEMP_SENSOR_1=0 EXTRUDERS=1"
171 git checkout UM2extended
172 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_Ultimaker2extended DEFINES="'STRING_CONFIG_H_AUTHOR=\"Version:_${BUILD_NAME}ex\"' TEMP_SENSOR_1=0 EXTRUDERS=1"
173 $MAKE -j 3 HARDWARE_MOTHERBOARD=72 ARDUINO_INSTALL_DIR=${ARDUINO_PATH} ARDUINO_VERSION=${ARDUINO_VERSION} BUILD_DIR=_Ultimaker2extendedDual DEFINES="'STRING_CONFIG_H_AUTHOR=\"Version:_${BUILD_NAME}ex\"' TEMP_SENSOR_1=20 EXTRUDERS=2"
176 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_250000/Marlin.hex resources/firmware/MarlinUltimaker-250000.hex
177 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_115200/Marlin.hex resources/firmware/MarlinUltimaker-115200.hex
178 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-250000-dual.hex
179 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-115200-dual.hex
180 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_250000/Marlin.hex resources/firmware/MarlinUltimaker-HBK-250000.hex
181 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_115200/Marlin.hex resources/firmware/MarlinUltimaker-HBK-115200.hex
182 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-HBK-250000-dual.hex
183 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-HBK-115200-dual.hex
184 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_250000/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-250000.hex
185 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_115200/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-115200.hex
186 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-250000-dual.hex
187 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-115200-dual.hex
188 cp _Ultimaker2Marlin/Marlin/_Ultimaker2/Marlin.hex resources/firmware/MarlinUltimaker2.hex
189 cp _Ultimaker2Marlin/Marlin/_Ultimaker2Dual/Marlin.hex resources/firmware/MarlinUltimaker2-dual.hex
190 cp _Ultimaker2Marlin/Marlin/_Ultimaker2go/Marlin.hex resources/firmware/MarlinUltimaker2go.hex
191 cp _Ultimaker2Marlin/Marlin/_Ultimaker2extended/Marlin.hex resources/firmware/MarlinUltimaker2extended.hex
192 cp _Ultimaker2Marlin/Marlin/_Ultimaker2extendedDual/Marlin.hex resources/firmware/MarlinUltimaker2extended-dual.hex
194 #############################
196 #############################
198 if [ "$BUILD_TARGET" = "darwin" ]; then
199 TARGET_DIR=Cura-${BUILD_NAME}-MacOS
201 rm -rf scripts/darwin/build
202 rm -rf scripts/darwin/dist
204 python build_app.py py2app
206 if [[ $rc != 0 ]]; then
207 echo "Cannot build app."
211 #Add cura version file (should read the version from the bundle with pyobjc, but will figure that out later)
212 echo $BUILD_NAME > scripts/darwin/dist/Cura.app/Contents/Resources/version
214 gitClone ${CURA_ENGINE_REPO} CuraEngine
215 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
216 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
217 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
218 cp CuraEngine/build/CuraEngine scripts/darwin/dist/Cura.app/Contents/Resources/CuraEngine
222 # Install QuickLook plugin
223 mkdir -p dist/Cura.app/Contents/Library/QuickLook
224 cp -a STLQuickLook.qlgenerator dist/Cura.app/Contents/Library/QuickLook/
228 $TAR cfp - Cura.app | gzip --best -c > ../../../${TARGET_DIR}.tar.gz
231 # Create sparse image for distribution
232 hdiutil detach /Volumes/Cura\ -\ Ultimaker/
233 rm -rf Cura.dmg.sparseimage
234 hdiutil convert DmgTemplateCompressed.dmg -format UDSP -o Cura.dmg
235 hdiutil resize -size 500m Cura.dmg.sparseimage
236 hdiutil attach Cura.dmg.sparseimage
237 cp -a dist/Cura.app /Volumes/Cura\ -\ Ultimaker/Cura/
238 hdiutil detach /Volumes/Cura\ -\ Ultimaker
239 hdiutil convert Cura.dmg.sparseimage -format UDZO -imagekey zlib-level=9 -ov -o ../../${TARGET_DIR}.dmg
243 #############################
244 # FreeBSD part by CeDeROM
245 #############################
247 if [ "$BUILD_TARGET" = "freebsd" ]; then
249 gitClone https://github.com/GreatFruitOmsk/Power Power
250 gitClone ${CURA_ENGINE_REPO} CuraEngine
251 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
252 gmake -j4 -C CuraEngine VERSION=${BUILD_NAME}
253 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
254 rm -rf scripts/freebsd/dist
255 mkdir -p scripts/freebsd/dist/share/cura
256 mkdir -p scripts/freebsd/dist/share/applications
257 mkdir -p scripts/freebsd/dist/bin
258 cp -a Cura scripts/freebsd/dist/share/cura/
259 cp -a resources scripts/freebsd/dist/share/cura/
260 cp -a plugins scripts/freebsd/dist/share/cura/
261 cp -a CuraEngine/build/CuraEngine scripts/freebsd/dist/share/cura/
262 cp scripts/freebsd/cura.py scripts/freebsd/dist/share/cura/
263 cp scripts/freebsd/cura.desktop scripts/freebsd/dist/share/applications/
264 cp scripts/freebsd/cura scripts/freebsd/dist/bin/
265 cp -a Power/power scripts/freebsd/dist/share/cura/
266 echo $BUILD_NAME > scripts/freebsd/dist/share/cura/Cura/version
267 #Create file list (pkg-plist)
268 cd scripts/freebsd/dist
269 find * -type f > ../pkg-plist
270 DIRLVL=20; while [ $DIRLVL -ge 0 ]; do
271 DIRS=`find share/cura -type d -depth $DIRLVL`
273 echo "@dirrm $DIR" >> ../pkg-plist
275 DIRLVL=`expr $DIRLVL - 1`
278 # Create archive or package if root
279 if [ `whoami` == "root" ]; then
280 echo "Are you root? Use the Port Luke! :-)"
282 echo "You are not root, building simple package archive..."
284 $TAR czf ../../${TARGET_DIR}.tar.gz dist/**
289 #############################
291 #############################
293 if [ "$BUILD_TARGET" = "debian_i386" ]; then
294 export CXX="g++ -m32"
295 gitClone https://github.com/GreatFruitOmsk/Power Power
296 gitClone ${CURA_ENGINE_REPO} CuraEngine
297 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
298 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
299 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
300 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
301 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
302 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
303 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
304 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
305 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
306 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
307 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
308 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
309 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/i386/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
310 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
311 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
312 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
314 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
315 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
319 #############################
321 #############################
323 if [ "$BUILD_TARGET" = "debian_amd64" ]; then
324 export CXX="g++ -m64"
325 gitClone https://github.com/GreatFruitOmsk/Power Power
326 gitClone ${CURA_ENGINE_REPO} CuraEngine
327 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
328 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
329 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
330 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
331 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
332 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
333 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
334 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
335 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
336 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
337 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
338 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
339 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/amd64/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
340 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
341 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
342 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
344 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
345 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
349 #############################
351 #############################
353 if [ "$BUILD_TARGET" = "debian_armhf" ]; then
355 gitClone https://github.com/GreatFruitOmsk/Power Power
356 gitClone ${CURA_ENGINE_REPO} CuraEngine
357 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
358 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
359 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
360 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
361 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
362 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
363 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
364 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
365 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
366 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
367 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
368 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
369 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/armhf/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
370 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
371 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
372 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
374 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
375 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
379 #############################
381 #############################
383 #############################
384 # Download all needed files.
385 #############################
387 if [ $BUILD_TARGET = "win32" ]; then
388 #Get portable python for windows and extract it. (Linux and Mac need to install python themselfs)
389 downloadURL http://ftp.nluug.nl/languages/python/portablepython/v2.7/PortablePython_${WIN_PORTABLE_PY_VERSION}.exe
390 downloadURL http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.win32.exe
391 downloadURL http://sourceforge.net/projects/pyopengl/files/PyOpenGL/3.0.1/PyOpenGL-3.0.1.win32.exe
392 downloadURL http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-win32-superpack-python2.7.exe
393 downloadURL http://videocapture.sourceforge.net/VideoCapture-0.9-5.zip
394 #downloadURL http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120927-git-13f0cd6-win32-static.7z
395 downloadURL http://sourceforge.net/projects/comtypes/files/comtypes/0.6.2/comtypes-0.6.2.win32.exe
396 downloadURL http://www.uwe-sieber.de/files/ejectmedia.zip
397 #Get the power module for python
398 gitClone https://github.com/GreatFruitOmsk/Power Power
399 if [ $? != 0 ]; then echo "Failed to clone Power"; exit 1; fi
400 gitClone ${CURA_ENGINE_REPO} CuraEngine
401 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
404 #############################
406 #############################
408 mkdir -p ${TARGET_DIR}
411 if [ $BUILD_TARGET = "win32" ]; then
412 if [ -z `which i686-w64-mingw32-g++` ]; then
415 CXX=i686-w64-mingw32-g++
418 #For windows extract portable python to include it.
419 extract PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/App
420 extract PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/Lib/site-packages
421 extract pyserial-2.5.win32.exe PURELIB
422 extract PyOpenGL-3.0.1.win32.exe PURELIB
423 extract numpy-1.6.2-win32-superpack-python2.7.exe numpy-1.6.2-sse2.exe
424 extract numpy-1.6.2-sse2.exe PLATLIB
425 extract VideoCapture-0.9-5.zip VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd
426 #extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe
427 #extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/licenses
428 extract comtypes-0.6.2.win32.exe
429 extract ejectmedia.zip Win32
431 mkdir -p ${TARGET_DIR}/python
432 mkdir -p ${TARGET_DIR}/Cura/
433 mv \$_OUTDIR/App/* ${TARGET_DIR}/python
434 mv \$_OUTDIR/Lib/site-packages/wx* ${TARGET_DIR}/python/Lib/site-packages/
435 mv PURELIB/serial ${TARGET_DIR}/python/Lib
436 mv PURELIB/OpenGL ${TARGET_DIR}/python/Lib
437 mv PURELIB/comtypes ${TARGET_DIR}/python/Lib
438 mv PLATLIB/numpy ${TARGET_DIR}/python/Lib
439 mv Power/power ${TARGET_DIR}/python/Lib
440 mv VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd ${TARGET_DIR}/python/DLLs
441 #mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura/
442 #mv ffmpeg-20120927-git-13f0cd6-win32-static/licenses ${TARGET_DIR}/Cura/ffmpeg-licenses/
443 mv Win32/EjectMedia.exe ${TARGET_DIR}/Cura/
449 rm -rf VideoCapture-0.9-5
450 rm -rf numpy-1.6.2-sse2.exe
451 #rm -rf ffmpeg-20120927-git-13f0cd6-win32-static
453 #Clean up portable python a bit, to keep the package size down.
454 rm -rf ${TARGET_DIR}/python/PyScripter.*
455 rm -rf ${TARGET_DIR}/python/Doc
456 rm -rf ${TARGET_DIR}/python/locale
457 rm -rf ${TARGET_DIR}/python/tcl
458 rm -rf ${TARGET_DIR}/python/Lib/test
459 rm -rf ${TARGET_DIR}/python/Lib/distutils
460 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/tools
461 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/locale
462 #Remove the gle files because they require MSVCR71.dll, which is not included. We also don't need gle, so it's safe to remove it.
463 rm -rf ${TARGET_DIR}/python/Lib/OpenGL/DLLS/gle*
465 #Build the C++ engine
466 $MAKE -C CuraEngine VERSION=${BUILD_NAME} OS=Windows_NT CXX=${CXX}
467 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
471 mkdir -p ${TARGET_DIR}/Cura ${TARGET_DIR}/resources ${TARGET_DIR}/plugins
472 cp -a Cura/* ${TARGET_DIR}/Cura
473 cp -a resources/* ${TARGET_DIR}/resources
474 cp -a plugins/* ${TARGET_DIR}/plugins
475 #Add cura version file
476 echo $BUILD_NAME > ${TARGET_DIR}/Cura/version
479 if [ $BUILD_TARGET = "win32" ]; then
480 cp -a scripts/${BUILD_TARGET}/*.bat $TARGET_DIR/
481 cp CuraEngine/build/CuraEngine.exe $TARGET_DIR
482 cp /usr/lib/gcc/i686-w64-mingw32/4.8/libgcc_s_sjlj-1.dll $TARGET_DIR
483 cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll $TARGET_DIR
484 cp /usr/lib/gcc/i686-w64-mingw32/4.8/libstdc++-6.dll $TARGET_DIR
488 if (( ${ARCHIVE_FOR_DISTRIBUTION} )); then
489 if [ $BUILD_TARGET = "win32" ]; then
490 #rm ${TARGET_DIR}.zip
492 #7z a ../${TARGET_DIR}.zip *
495 if [ ! -z `which wine` ]; then
496 #if we have wine, try to run our nsis script.
497 rm -rf scripts/win32/dist
498 ln -sf `pwd`/${TARGET_DIR} scripts/win32/dist
499 wine ~/.wine/drive_c/Program\ Files\ \(x86\)/NSIS/makensis.exe /DVERSION=${BUILD_NAME} scripts/win32/installer.nsi
500 if [ $? != 0 ]; then echo "Failed to package NSIS installer"; exit 1; fi
501 mv scripts/win32/Cura_${BUILD_NAME}.exe ./
503 if [ -f '/c/Program Files (x86)/NSIS/makensis.exe' ]; then
504 rm -rf scripts/win32/dist
505 mv `pwd`/${TARGET_DIR} scripts/win32/dist
506 '/c/Program Files (x86)/NSIS/makensis.exe' -DVERSION=${BUILD_NAME} 'scripts/win32/installer.nsi' >> log.txt
507 if [ $? != 0 ]; then echo "Failed to package NSIS installer"; exit 1; fi
508 mv scripts/win32/Cura_${BUILD_NAME}.exe ./
511 echo "Archiving to ${TARGET_DIR}.tar.gz"
512 $TAR cfp - ${TARGET_DIR} | gzip --best -c > ${TARGET_DIR}.tar.gz
515 echo "Installed into ${TARGET_DIR}"