6 # This script is to package the Cura package for Windows/Linux and Mac OS X
7 # This script should run under Linux and Mac OS X, as well as Windows with Cygwin.
9 #############################
11 #############################
13 ##Select the build target
14 BUILD_TARGET=${1:-none}
17 #BUILD_TARGET=debian_i386
18 #BUILD_TARGET=debian_amd64
19 #BUILD_TARGET=debian_armhf
22 ##Do we need to create the final archive
23 ARCHIVE_FOR_DISTRIBUTION=1
24 ##Which version name are we appending to the final archive
25 export BUILD_NAME=15.01-RC7
26 TARGET_DIR=Cura-${BUILD_NAME}-${BUILD_TARGET}
28 ##Which versions of external programs to use
29 WIN_PORTABLE_PY_VERSION=2.7.2.1
31 ##Which CuraEngine to use
32 if [ -z ${CURA_ENGINE_REPO:-} ] ; then
33 CURA_ENGINE_REPO="git@github.com:Ultimaker/CuraEngine.git"
36 #############################
38 #############################
41 if [ -z "`which $1`" ]; then
42 echo "The $1 command must be somewhere in your \$PATH."
43 echo "Fix your \$PATH or install $2"
50 filename=`basename "$1"`
51 echo "Checking for $filename"
52 if [ ! -f "$filename" ]; then
56 echo "Failed to download $1"
65 echo "7z x -y $*" >> log.txt
68 echo "Failed to extract $*"
75 echo "Cloning $1 into $2"
87 #############################
89 #############################
90 if [ "$BUILD_TARGET" = "none" ]; then
91 echo "You need to specify a build target with:"
94 echo "$0 debian_amd64"
95 echo "$0 debian_armhf"
101 if [ -z `which make` ]; then
107 # Change working directory to the directory the script is in
108 # http://stackoverflow.com/a/246128
109 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
112 checkTool git "git: http://git-scm.com/"
113 checkTool curl "curl: http://curl.haxx.se/"
114 if [ $BUILD_TARGET = "win32" ]; then
115 checkTool avr-gcc "avr-gcc: http://winavr.sourceforge.net/ "
116 #Check if we have 7zip, needed to extract and packup a bunch of packages for windows.
117 checkTool 7z "7zip: http://www.7-zip.org/"
118 checkTool $MAKE "mingw: http://www.mingw.org/"
120 #For building under MacOS we need gnutar instead of tar
121 if [ -z `which gnutar` ]; then
127 #############################
128 # Build the required firmwares
129 #############################
131 if [ -d "C:/arduino-1.0.3" ]; then
132 ARDUINO_PATH=C:/arduino-1.0.3
134 elif [ -d "/Applications/Arduino.app/Contents/Resources/Java" ]; then
135 ARDUINO_PATH=/Applications/Arduino.app/Contents/Resources/Java
138 ARDUINO_PATH=/usr/share/arduino
142 if [ ! -d "$ARDUINO_PATH" ]; then
143 echo "Arduino path '$ARDUINO_PATH' doesn't exist"
147 #Build the Ultimaker Original firmwares.
148 gitClone git@github.com:Ultimaker/Marlin.git _UltimakerMarlin
149 cd _UltimakerMarlin/Marlin
150 git checkout Marlin_v1
151 $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"
152 $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"
153 $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"
154 $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"
155 git checkout Marlin_UM_HeatedBedUpgrade
156 $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"
157 $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"
158 $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"
159 $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"
160 git checkout Marlin_UM_Original_Plus
161 $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"
162 $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"
163 $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"
164 $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"
167 gitClone git@github.com:Ultimaker/Ultimaker2Marlin.git _Ultimaker2Marlin
168 cd _Ultimaker2Marlin/Marlin
170 $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"
171 $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"
173 $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"
174 git checkout UM2extended
175 $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"
176 $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"
179 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_250000/Marlin.hex resources/firmware/MarlinUltimaker-250000.hex
180 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_115200/Marlin.hex resources/firmware/MarlinUltimaker-115200.hex
181 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-250000-dual.hex
182 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-115200-dual.hex
183 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_250000/Marlin.hex resources/firmware/MarlinUltimaker-HBK-250000.hex
184 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_115200/Marlin.hex resources/firmware/MarlinUltimaker-HBK-115200.hex
185 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-HBK-250000-dual.hex
186 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_HBK_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-HBK-115200-dual.hex
187 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_250000/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-250000.hex
188 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_115200/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-115200.hex
189 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_Dual_250000/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-250000-dual.hex
190 cp _UltimakerMarlin/Marlin/_UltimakerMarlin_Plus_Dual_115200/Marlin.hex resources/firmware/MarlinUltimaker-UMOP-115200-dual.hex
191 cp _Ultimaker2Marlin/Marlin/_Ultimaker2/Marlin.hex resources/firmware/MarlinUltimaker2.hex
192 cp _Ultimaker2Marlin/Marlin/_Ultimaker2Dual/Marlin.hex resources/firmware/MarlinUltimaker2-dual.hex
193 cp _Ultimaker2Marlin/Marlin/_Ultimaker2go/Marlin.hex resources/firmware/MarlinUltimaker2go.hex
194 cp _Ultimaker2Marlin/Marlin/_Ultimaker2extended/Marlin.hex resources/firmware/MarlinUltimaker2extended.hex
195 cp _Ultimaker2Marlin/Marlin/_Ultimaker2extendedDual/Marlin.hex resources/firmware/MarlinUltimaker2extended-dual.hex
197 #############################
199 #############################
201 if [ "$BUILD_TARGET" = "darwin" ]; then
202 TARGET_DIR=Cura-${BUILD_NAME}-MacOS
204 rm -rf scripts/darwin/build
205 rm -rf scripts/darwin/dist
207 python build_app.py py2app
209 if [[ $rc != 0 ]]; then
210 echo "Cannot build app."
214 #Add cura version file (should read the version from the bundle with pyobjc, but will figure that out later)
215 echo $BUILD_NAME > scripts/darwin/dist/Cura.app/Contents/Resources/version
217 gitClone ${CURA_ENGINE_REPO} CuraEngine
218 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
219 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
220 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
221 cp CuraEngine/build/CuraEngine scripts/darwin/dist/Cura.app/Contents/Resources/CuraEngine
225 # Install QuickLook plugin
226 mkdir -p dist/Cura.app/Contents/Library/QuickLook
227 cp -a STLQuickLook.qlgenerator dist/Cura.app/Contents/Library/QuickLook/
231 $TAR cfp - Cura.app | gzip --best -c > ../../../${TARGET_DIR}.tar.gz
234 # Create sparse image for distribution
235 hdiutil detach /Volumes/Cura\ -\ Ultimaker/
236 rm -rf Cura.dmg.sparseimage
237 hdiutil convert DmgTemplateCompressed.dmg -format UDSP -o Cura.dmg
238 hdiutil resize -size 500m Cura.dmg.sparseimage
239 hdiutil attach Cura.dmg.sparseimage
240 cp -a dist/Cura.app /Volumes/Cura\ -\ Ultimaker/Cura/
241 hdiutil detach /Volumes/Cura\ -\ Ultimaker
242 hdiutil convert Cura.dmg.sparseimage -format UDZO -imagekey zlib-level=9 -ov -o ../../${TARGET_DIR}.dmg
246 #############################
247 # FreeBSD part by CeDeROM
248 #############################
250 if [ "$BUILD_TARGET" = "freebsd" ]; then
252 gitClone https://github.com/GreatFruitOmsk/Power Power
253 gitClone ${CURA_ENGINE_REPO} CuraEngine
254 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
255 gmake -j4 -C CuraEngine VERSION=${BUILD_NAME}
256 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
257 rm -rf scripts/freebsd/dist
258 mkdir -p scripts/freebsd/dist/share/cura
259 mkdir -p scripts/freebsd/dist/share/applications
260 mkdir -p scripts/freebsd/dist/bin
261 cp -a Cura scripts/freebsd/dist/share/cura/
262 cp -a resources scripts/freebsd/dist/share/cura/
263 cp -a plugins scripts/freebsd/dist/share/cura/
264 cp -a CuraEngine/build/CuraEngine scripts/freebsd/dist/share/cura/
265 cp scripts/freebsd/cura.py scripts/freebsd/dist/share/cura/
266 cp scripts/freebsd/cura.desktop scripts/freebsd/dist/share/applications/
267 cp scripts/freebsd/cura scripts/freebsd/dist/bin/
268 cp -a Power/power scripts/freebsd/dist/share/cura/
269 echo $BUILD_NAME > scripts/freebsd/dist/share/cura/Cura/version
270 #Create file list (pkg-plist)
271 cd scripts/freebsd/dist
272 find * -type f > ../pkg-plist
273 DIRLVL=20; while [ $DIRLVL -ge 0 ]; do
274 DIRS=`find share/cura -type d -depth $DIRLVL`
276 echo "@dirrm $DIR" >> ../pkg-plist
278 DIRLVL=`expr $DIRLVL - 1`
281 # Create archive or package if root
282 if [ `whoami` == "root" ]; then
283 echo "Are you root? Use the Port Luke! :-)"
285 echo "You are not root, building simple package archive..."
287 $TAR czf ../../${TARGET_DIR}.tar.gz dist/**
292 #############################
294 #############################
296 if [ "$BUILD_TARGET" = "debian_i386" ]; then
297 export CXX="g++ -m32"
298 gitClone https://github.com/GreatFruitOmsk/Power Power
299 gitClone ${CURA_ENGINE_REPO} CuraEngine
300 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
301 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
302 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
303 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
304 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
305 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
306 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
307 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
308 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
309 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
310 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
311 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
312 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/i386/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
313 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
314 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
315 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
317 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
318 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
322 #############################
324 #############################
326 if [ "$BUILD_TARGET" = "debian_amd64" ]; then
327 export CXX="g++ -m64"
328 gitClone https://github.com/GreatFruitOmsk/Power Power
329 gitClone ${CURA_ENGINE_REPO} CuraEngine
330 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
331 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
332 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
333 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
334 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
335 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
336 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
337 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
338 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
339 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
340 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
341 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
342 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/amd64/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
343 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
344 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
345 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
347 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
348 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
352 #############################
354 #############################
356 if [ "$BUILD_TARGET" = "debian_armhf" ]; then
358 gitClone https://github.com/GreatFruitOmsk/Power Power
359 gitClone ${CURA_ENGINE_REPO} CuraEngine
360 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
361 $MAKE -C CuraEngine VERSION=${BUILD_NAME}
362 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
363 rm -rf scripts/linux/${BUILD_TARGET}/usr/share/cura
364 mkdir -p scripts/linux/${BUILD_TARGET}/usr/share/cura
365 cp -a Cura scripts/linux/${BUILD_TARGET}/usr/share/cura/
366 cp -a resources scripts/linux/${BUILD_TARGET}/usr/share/cura/
367 cp -a plugins scripts/linux/${BUILD_TARGET}/usr/share/cura/
368 cp -a CuraEngine/build/CuraEngine scripts/linux/${BUILD_TARGET}/usr/share/cura/
369 cp scripts/linux/cura.py scripts/linux/${BUILD_TARGET}/usr/share/cura/
370 cp -a Power/power scripts/linux/${BUILD_TARGET}/usr/share/cura/
371 echo $BUILD_NAME > scripts/linux/${BUILD_TARGET}/usr/share/cura/Cura/version
372 cat scripts/linux/debian_control | sed "s/\[BUILD_NAME\]/${BUILD_NAME}/" | sed 's/\[ARCH\]/armhf/' > scripts/linux/${BUILD_TARGET}/DEBIAN/control
373 sudo chown root:root scripts/linux/${BUILD_TARGET} -R
374 sudo chmod 755 scripts/linux/${BUILD_TARGET}/usr -R
375 sudo chmod 755 scripts/linux/${BUILD_TARGET}/DEBIAN -R
377 dpkg-deb --build ${BUILD_TARGET} $(dirname ${TARGET_DIR})/cura_${BUILD_NAME}-${BUILD_TARGET}.deb
378 sudo chown `id -un`:`id -gn` ${BUILD_TARGET} -R
382 #############################
384 #############################
386 #############################
387 # Download all needed files.
388 #############################
390 if [ $BUILD_TARGET = "win32" ]; then
391 #Get portable python for windows and extract it. (Linux and Mac need to install python themselfs)
392 downloadURL http://ftp.nluug.nl/languages/python/portablepython/v2.7/PortablePython_${WIN_PORTABLE_PY_VERSION}.exe
393 downloadURL http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.win32.exe
394 downloadURL http://sourceforge.net/projects/pyopengl/files/PyOpenGL/3.0.1/PyOpenGL-3.0.1.win32.exe
395 downloadURL http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-win32-superpack-python2.7.exe
396 downloadURL http://videocapture.sourceforge.net/VideoCapture-0.9-5.zip
397 #downloadURL http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120927-git-13f0cd6-win32-static.7z
398 downloadURL http://sourceforge.net/projects/comtypes/files/comtypes/0.6.2/comtypes-0.6.2.win32.exe
399 downloadURL http://www.uwe-sieber.de/files/ejectmedia.zip
400 #Get the power module for python
401 gitClone https://github.com/GreatFruitOmsk/Power Power
402 if [ $? != 0 ]; then echo "Failed to clone Power"; exit 1; fi
403 gitClone ${CURA_ENGINE_REPO} CuraEngine
404 if [ $? != 0 ]; then echo "Failed to clone CuraEngine"; exit 1; fi
407 #############################
409 #############################
411 mkdir -p ${TARGET_DIR}
414 if [ $BUILD_TARGET = "win32" ]; then
415 if [ -z `which i686-w64-mingw32-g++` ]; then
418 CXX=i686-w64-mingw32-g++
421 #For windows extract portable python to include it.
422 extract PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/App
423 extract PortablePython_${WIN_PORTABLE_PY_VERSION}.exe \$_OUTDIR/Lib/site-packages
424 extract pyserial-2.5.win32.exe PURELIB
425 extract PyOpenGL-3.0.1.win32.exe PURELIB
426 extract numpy-1.6.2-win32-superpack-python2.7.exe numpy-1.6.2-sse2.exe
427 extract numpy-1.6.2-sse2.exe PLATLIB
428 extract VideoCapture-0.9-5.zip VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd
429 #extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe
430 #extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/licenses
431 extract comtypes-0.6.2.win32.exe
432 extract ejectmedia.zip Win32
434 mkdir -p ${TARGET_DIR}/python
435 mkdir -p ${TARGET_DIR}/Cura/
436 mv \$_OUTDIR/App/* ${TARGET_DIR}/python
437 mv \$_OUTDIR/Lib/site-packages/wx* ${TARGET_DIR}/python/Lib/site-packages/
438 mv PURELIB/serial ${TARGET_DIR}/python/Lib
439 mv PURELIB/OpenGL ${TARGET_DIR}/python/Lib
440 mv PURELIB/comtypes ${TARGET_DIR}/python/Lib
441 mv PLATLIB/numpy ${TARGET_DIR}/python/Lib
442 mv Power/power ${TARGET_DIR}/python/Lib
443 mv VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd ${TARGET_DIR}/python/DLLs
444 #mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura/
445 #mv ffmpeg-20120927-git-13f0cd6-win32-static/licenses ${TARGET_DIR}/Cura/ffmpeg-licenses/
446 mv Win32/EjectMedia.exe ${TARGET_DIR}/Cura/
452 rm -rf VideoCapture-0.9-5
453 rm -rf numpy-1.6.2-sse2.exe
454 #rm -rf ffmpeg-20120927-git-13f0cd6-win32-static
456 #Clean up portable python a bit, to keep the package size down.
457 rm -rf ${TARGET_DIR}/python/PyScripter.*
458 rm -rf ${TARGET_DIR}/python/Doc
459 rm -rf ${TARGET_DIR}/python/locale
460 rm -rf ${TARGET_DIR}/python/tcl
461 rm -rf ${TARGET_DIR}/python/Lib/test
462 rm -rf ${TARGET_DIR}/python/Lib/distutils
463 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/tools
464 rm -rf ${TARGET_DIR}/python/Lib/site-packages/wx-2.8-msw-unicode/wx/locale
465 #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.
466 rm -rf ${TARGET_DIR}/python/Lib/OpenGL/DLLS/gle*
468 #Build the C++ engine
469 $MAKE -C CuraEngine VERSION=${BUILD_NAME} OS=Windows_NT CXX=${CXX}
470 if [ $? != 0 ]; then echo "Failed to build CuraEngine"; exit 1; fi
474 mkdir -p ${TARGET_DIR}/Cura ${TARGET_DIR}/resources ${TARGET_DIR}/plugins
475 cp -a Cura/* ${TARGET_DIR}/Cura
476 cp -a resources/* ${TARGET_DIR}/resources
477 cp -a plugins/* ${TARGET_DIR}/plugins
478 #Add cura version file
479 echo $BUILD_NAME > ${TARGET_DIR}/Cura/version
482 if [ $BUILD_TARGET = "win32" ]; then
483 cp -a scripts/${BUILD_TARGET}/*.bat $TARGET_DIR/
484 cp CuraEngine/build/CuraEngine.exe $TARGET_DIR
485 cp /usr/lib/gcc/i686-w64-mingw32/4.8/libgcc_s_sjlj-1.dll $TARGET_DIR
486 cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll $TARGET_DIR
487 cp /usr/lib/gcc/i686-w64-mingw32/4.8/libstdc++-6.dll $TARGET_DIR
491 if (( ${ARCHIVE_FOR_DISTRIBUTION} )); then
492 if [ $BUILD_TARGET = "win32" ]; then
493 #rm ${TARGET_DIR}.zip
495 #7z a ../${TARGET_DIR}.zip *
498 if [ ! -z `which wine` ]; then
499 #if we have wine, try to run our nsis script.
500 rm -rf scripts/win32/dist
501 ln -sf `pwd`/${TARGET_DIR} scripts/win32/dist
502 wine ~/.wine/drive_c/Program\ Files\ \(x86\)/NSIS/makensis.exe /DVERSION=${BUILD_NAME} scripts/win32/installer.nsi
503 if [ $? != 0 ]; then echo "Failed to package NSIS installer"; exit 1; fi
504 mv scripts/win32/Cura_${BUILD_NAME}.exe ./
506 if [ -f '/c/Program Files (x86)/NSIS/makensis.exe' ]; then
507 rm -rf scripts/win32/dist
508 mv `pwd`/${TARGET_DIR} scripts/win32/dist
509 '/c/Program Files (x86)/NSIS/makensis.exe' -DVERSION=${BUILD_NAME} 'scripts/win32/installer.nsi' >> log.txt
510 if [ $? != 0 ]; then echo "Failed to package NSIS installer"; exit 1; fi
511 mv scripts/win32/Cura_${BUILD_NAME}.exe ./
514 echo "Archiving to ${TARGET_DIR}.tar.gz"
515 $TAR cfp - ${TARGET_DIR} | gzip --best -c > ${TARGET_DIR}.tar.gz
518 echo "Installed into ${TARGET_DIR}"