mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 01:09:02 +08:00
package Slic3r for OSX post-build.
This commit is contained in:
parent
36e148929b
commit
9dd1f24b15
76
package/osx/make_dmg.sh
Executable file
76
package/osx/make_dmg.sh
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Assembles an installation bundle from a built copy of Slic3r.
|
||||||
|
# Required environment variables:
|
||||||
|
# Adapted from script written by bubnikv for Prusa3D.
|
||||||
|
# SLIC3R_VERSION - x.x.x format
|
||||||
|
|
||||||
|
WD=$(dirname $0)
|
||||||
|
# Determine if this is a tagged (release) commit.
|
||||||
|
# Change the build id accordingly.
|
||||||
|
if [ $(git describe &>/dev/null) ]; then
|
||||||
|
TAGGED=true
|
||||||
|
SLIC3R_BUILD_ID=$(git describe)
|
||||||
|
else
|
||||||
|
TAGGED=false
|
||||||
|
SLIC3R_BUILD_ID=${SLIC3R_VERSION}d
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we're on a branch, add the branch name to the app name.
|
||||||
|
if [ "$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!')" == "master" ]; then
|
||||||
|
appname=Slic3r
|
||||||
|
dmgfile=${1}.dmg
|
||||||
|
else
|
||||||
|
appname=Slic3r-$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!')
|
||||||
|
dmgfile=${1}-$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!').dmg
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OSX Application folder shenanigans.
|
||||||
|
appfolder="$WD/${appname}.app"
|
||||||
|
macosfolder=$appfolder/Contents/MacOS
|
||||||
|
resourcefolder=$appfolder/Contents/Resources
|
||||||
|
plistfile=$appfolder/Contents/Info.plist
|
||||||
|
PkgInfoContents="APPL????"
|
||||||
|
source $WD/plist.sh
|
||||||
|
|
||||||
|
# Our slic3r dir and location of perl
|
||||||
|
PERL_BIN=$(which perl)
|
||||||
|
SLIC3R_DIR="${WD}/../../"
|
||||||
|
|
||||||
|
if [[ -d "${appfolder}" ]]; then
|
||||||
|
echo "Deleting old working folder."
|
||||||
|
rm -rf ${appfolder}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "${dmgfile}" ]]; then
|
||||||
|
echo "Deleting old dmg ${dmgfile}."
|
||||||
|
rm -rf ${dmgfile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Creating new app folder at $appfolder."
|
||||||
|
mkdir -p $appfolder
|
||||||
|
mkdir -p $macosfolder
|
||||||
|
mkdir -p $resourcefolder
|
||||||
|
|
||||||
|
echo "Copying resources..."
|
||||||
|
cp -r $SLIC3R_DIR/var $macosfolder/
|
||||||
|
mv $macosfolder/var/Slic3r.icns $resourcefolder
|
||||||
|
|
||||||
|
echo "Copying Slic3r..."
|
||||||
|
cp $SLIC3R_DIR/slic3r.pl $macosfolder/slic3r.pl
|
||||||
|
cp -r $SLIC3R_DIR/local-lib $macosfolder/local-lib
|
||||||
|
cp -r $SLIC3R_DIR/lib/* $macosfolder/local-lib/lib/perl5/
|
||||||
|
|
||||||
|
echo "Copying startup script..."
|
||||||
|
cp $WD/startup_script.sh $macosfolder/$appname
|
||||||
|
chmod +x $macosfolder/$appname
|
||||||
|
|
||||||
|
echo "Copying perl from $PERL_BIN"
|
||||||
|
cp $PERL_BIN $macosfolder
|
||||||
|
|
||||||
|
make_plist
|
||||||
|
|
||||||
|
echo $PkgInfoContents >$appfolder/Contents/PkgInfo
|
||||||
|
|
||||||
|
echo "Creating dmg file...."
|
||||||
|
hdiutil create -fs HFS+ -srcfolder "$appfolder" -volname "$appname" "$dmgfile"
|
39
package/osx/plist.sh
Normal file
39
package/osx/plist.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
function make_plist() {
|
||||||
|
# Create information property list file (Info.plist).
|
||||||
|
echo '<?xml version="1.0" encoding="UTF-8"?>' >$plistfile
|
||||||
|
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >>$plistfile
|
||||||
|
echo '<plist version="1.0">' >>$plistfile
|
||||||
|
echo '<dict>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleExecutable</key>' >>$plistfile
|
||||||
|
echo ' <string>'$appname'</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleGetInfoString</key>' >>$plistfile
|
||||||
|
echo " <string>Slic3r Copyright (C) 2011-$(date +%Y) Alessandro Ranellucci</string>" >>$plistfile
|
||||||
|
echo ' <key>CFBundleIconFile</key>' >>$plistfile
|
||||||
|
echo ' <string>Slic3r.icns</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleName</key>' >>$plistfile
|
||||||
|
echo ' <string>Slic3r</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleShortVersionString</key>' >>$plistfile
|
||||||
|
if [ $TAGGED ]; then
|
||||||
|
echo " <string>Slic3r $SLIC3R_BUILD_ID</string>" >>$plistfile
|
||||||
|
else
|
||||||
|
echo " <string>Slic3r $SLIC3R_BUILD_ID-$(git rev-parse --short head)</string>" >>$plistfile
|
||||||
|
fi
|
||||||
|
echo ' <key>CFBundleIdentifier</key>' >>$plistfile
|
||||||
|
echo ' <string></string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleInfoDictionaryVersion</key>' >>$plistfile
|
||||||
|
echo ' <string>6.0</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundlePackageType</key>' >>$plistfile
|
||||||
|
echo ' <string>APPL</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleSignature</key>' >>$plistfile
|
||||||
|
echo ' <string>????</string>' >>$plistfile
|
||||||
|
echo ' <key>CFBundleVersion</key>' >>$plistfile
|
||||||
|
echo " <string>${SLIC3R_BUILD_ID}</string>" >>$plistfile
|
||||||
|
echo ' <key>CFBundleIdentifier</key>' >>$plistfile
|
||||||
|
echo ' <string></string>' >>$plistfile
|
||||||
|
echo ' <key>CGDisableCoalescedUpdates</key>' >>$plistfile
|
||||||
|
echo ' <false/>' >>$plistfile
|
||||||
|
echo '</dict>' >>$plistfile
|
||||||
|
echo '</plist>' >>$plistfile
|
||||||
|
|
||||||
|
}
|
4
package/osx/startup_script.sh
Normal file
4
package/osx/startup_script.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DIR=$(dirname "$0")
|
||||||
|
$DIR/perl $DIR/slic3r.pl $@
|
Loading…
x
Reference in New Issue
Block a user