-else
- if [ ! -f "pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2" ]; then
- # curl -L -O https://bitbucket.org/pypy/pypy/downloads/pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2
- curl -L -O http://buildbot.pypy.org/nightly/trunk/pypy-${PYPY_VERSION}-${BUILD_TARGET}.tar.bz2
+
+ #Add cura version file (should read the version from the bundle with pyobjc, but will figure that out later)
+ echo $BUILD_NAME > scripts/darwin/dist/Cura.app/Contents/Resources/version
+ rm -rf CuraEngine
+ git clone ${CURA_ENGINE_REPO}
+ make -C CuraEngine
+ cp CuraEngine/CuraEngine scripts/darwin/dist/Cura.app/Contents/Resources/CuraEngine
+
+ cd scripts/darwin
+
+ # Install QuickLook plugin
+ mkdir -p dist/Cura.app/Contents/Library/QuickLook
+ cp -a STLQuickLook.qlgenerator dist/Cura.app/Contents/Library/QuickLook/
+
+ # Archive app
+ cd dist
+ $TAR cfp - Cura.app | gzip --best -c > ../../../${TARGET_DIR}.tar.gz
+ cd ..
+
+ # Create sparse image for distribution
+ hdiutil detach /Volumes/Cura\ -\ Ultimaker/
+ rm -rf Cura.dmg.sparseimage
+ hdiutil convert DmgTemplateCompressed.dmg -format UDSP -o Cura.dmg
+ hdiutil resize -size 500m Cura.dmg.sparseimage
+ hdiutil attach Cura.dmg.sparseimage
+ cp -a dist/Cura.app /Volumes/Cura\ -\ Ultimaker/Cura/
+ hdiutil detach /Volumes/Cura\ -\ Ultimaker
+ hdiutil convert Cura.dmg.sparseimage -format UDZO -imagekey zlib-level=9 -ov -o ../../${TARGET_DIR}.dmg
+ exit
+fi
+
+#############################
+# Debian .deb
+#############################
+
+if [ "$BUILD_TARGET" = "debian" ]; then
+ if [ ! -d "Power" ]; then
+ git clone https://github.com/GreatFruitOmsk/Power
+ else
+ cd Power
+ git pull
+ cd ..