aboutsummaryrefslogtreecommitdiff
path: root/tools/darwin/packaging/osx/mkdmg-osx.sh.in
blob: 33c13dd45aac65a599df5ec4e8e7219fda1fad9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

# usage: ./mkdmg-osx.sh release/debug (case insensitive)
# Allows us to run mkdmg-osx.sh from anywhere in the three, rather than the tools/darwin/packaging/osx folder only
SWITCH=`echo $1 | tr [A-Z] [a-z]`
DIRNAME=`dirname $0`

if [ ${SWITCH:-""} = "debug" ]; then
  echo "Packaging Debug target for OSX"
  APP="$DIRNAME/../../../../build/Debug/@APP_NAME@.app"
elif [ ${SWITCH:-""} = "release" ]; then
  echo "Packaging Release target for OSX"
  APP="$DIRNAME/../../../../build/Release/@APP_NAME@.app"
else
  echo "You need to specify the build target"
  exit 1 
fi

if [ ! -d $APP ]; then
  echo "@APP_NAME@.app not found! are you sure you built $1 target?"
  exit 1
fi
ARCHITECTURE=`file $APP/Contents/MacOS/@APP_NAME@ | awk '{print $NF}'`

PACKAGE=org.xbmc.@APP_NAME_LC@-osx

VERSION=@APP_VERSION_MAJOR@.@APP_VERSION_MINOR@
REVISION=0~@APP_VERSION_TAG_LC@
ARCHIVE=${PACKAGE}_${VERSION}-${REVISION}_macosx-intel-${ARCHITECTURE}

echo Creating $PACKAGE package version $VERSION revision $REVISION
${SUDO} rm -rf $DIRNAME/$ARCHIVE

if [ -e "/Volumes/$ARCHIVE" ]
then 
  umount /Volumes/$ARCHIVE
fi

#generate volume iconset
if [ `which iconutil` ]
then
  echo "Generating volumeIcon.icns"
  iconutil -c icns --output "VolumeIcon.icns" "../media/osx/volumeIcon.iconset"
fi

$DIRNAME/dmgmaker.pl $APP $ARCHIVE

echo "done"