File: INSTALL.MAC

package info (click to toggle)
valknut 0.3.13-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 10,156 kB
  • ctags: 1,862
  • sloc: cpp: 22,101; sh: 15,814; perl: 2,795; xml: 2,165; makefile: 234
file content (157 lines) | stat: -rw-r--r-- 5,444 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
#
# Version 1.0
# 2007-01-10
# Hanspeter Niederstrasser
#
# Link to the native OSX-Thread:
# http://dcgui.berlios.de/forum/viewtopic.php?t=1478
#
# based on original install script from ravemax,
# and NYZeta's HowTo at
# http://www.stud.ntnu.no/~chrisj/download/howto/valknut_howto.html
#
# Here is a script that creates an .app after "make all" 
# no "make install" is required:
#

QTMACDIR=${QTDIR}
TS_TO_QM=${QTDIR}/bin/lrelease 

if [ ! -x "${TS_TO_QM}" ]; then
	echo "Couldn't find >> lrelease << to prepare the translation files."
	echo "Are you sure ${TS_TO_QM} is the correct location?"
	echo "Also check that \$QTDIR points to where it should."
	echo "This script thinks \$QTDIR = ${QTDIR}."
	echo ""
	echo "Exiting.  Fix the above error and try again."
	exit 1
fi

PROG_NAME=valknut
BUNDLE_NAME=Valknut
APP_DIR=${BUNDLE_NAME}.app

APP_VERSION=0.3.8
APP_SERIAL=20061213

TS_DIR=${PROG_NAME}/ts
TRANS_TARGET=${APP_DIR}/translation

SOUNDS_DIR=${PROG_NAME}/sounds
SOUNDS_TARGET=${APP_DIR}/sounds

PLUGIN_DIR=${PROG_NAME}/plugin
PLUGIN_TARGET=${APP_DIR}/plugin

ICONS_DIR=${PROG_NAME}/icons
ICONS_TARGET=${APP_DIR}/icons

CNT_TARGET=${APP_DIR}/Contents

MACOS_TARGET=${CNT_TARGET}/MacOS
RSC_TARGET=${CNT_TARGET}/Resources

DMG_TARGET="${BUNDLE_NAME} ${APP_VERSION}"

# Build .app bundle
echo "Creating application bundle       ${APP_DIR}"
/usr/bin/install -d -m 755 ${APP_DIR}

# Translation files 
echo "Creating translations target      ${TRANS_TARGET}"
/usr/bin/install -d -m 755  ${TRANS_TARGET}

echo "Copying translations from         ${TS_DIR}"
for i in ${TS_DIR}/*.ts; do 
	${TS_TO_QM} $i; 
	/bin/mv ${TS_DIR}/$(basename $i ts)qm ${TRANS_TARGET}
done 
echo "Installed translation files to    ${TRANS_TARGET}"

# Sounds
echo "Creating sounds target            ${SOUNDS_TARGET}"
/usr/bin/install -d -m 755  ${SOUNDS_TARGET}/default

# Plugin
echo "Creating plugins target           ${PLUGIN_TARGET}"
/usr/bin/install -d -m 755  ${PLUGIN_TARGET}

# Icons
echo "Creating icons target             ${ICONS_TARGET}"
/usr/bin/install -d -m 755 ${ICONS_TARGET}/appl/default
/usr/bin/install -d -m 755 ${ICONS_TARGET}/emot/default
/usr/bin/install -d -m 755 ${ICONS_TARGET}/user/default

echo "Copying icons from                ${ICONS_DIR}"
/usr/bin/install -m 644 ${ICONS_DIR}/*.xpm ${ICONS_TARGET}/appl/default
/usr/bin/install -m 644 ${ICONS_DIR}/*.xml ${ICONS_TARGET}/appl/default

/bin/mv ${ICONS_TARGET}/appl/default/emoticons.xml ${ICONS_TARGET}/emot/default
/bin/mv ${ICONS_TARGET}/appl/default/emoticons.xpm ${ICONS_TARGET}/emot/default

/bin/mv ${ICONS_TARGET}/appl/default/usericons.xml ${ICONS_TARGET}/user/default
/bin/mv ${ICONS_TARGET}/appl/default/usericons.xpm ${ICONS_TARGET}/user/default

# Contents 
echo "Creating Contents target          ${CNT_TARGET}"
/usr/bin/install -d -m 755 ${CNT_TARGET}

echo "Installing Info.plist."
/usr/bin/sed -e "s|%VERS%|$APP_VERSION|g;s|%SERIAL%|$APP_SERIAL|g" Info.plist.in > ${CNT_TARGET}/Info.plist

echo "Installing PkgInfo."
/usr/bin/install -m 644 PkgInfo.in ${CNT_TARGET}/PkgInfo

echo "Creating MacOS target             ${MACOS_TARGET}"
/usr/bin/install -d -m 755 ${MACOS_TARGET}

echo "Copying executable from           ${PROG_NAME}/"
/usr/bin/install -m 755 ${PROG_NAME}/${PROG_NAME} ${MACOS_TARGET}/${PROG_NAME}

echo "Stripping executable              ${PROG_NAME}"
/usr/bin/strip ${MACOS_TARGET}/${PROG_NAME}

# Copy the .dylibs that are linked by the program
# This loop is only needed if you want to build a standalone ,app.
echo "Copying the shared libraries to   ${MACOS_TARGET}"
for i in `otool -L ${MACOS_TARGET}/${PROG_NAME} | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib` ; do
	/bin/cp -p ${i} ${MACOS_TARGET};
	echo "Copied `basename ${i}`"
	/usr/bin/install_name_tool -change ${i} @executable_path/`basename ${i}` ${MACOS_TARGET}/${PROG_NAME};
	# now check paths for other libraries linked by the copied libraries.
	for j in `otool -L ${i} | grep version | cut -f 1 -d ' '| grep -v ${i} | grep -v \/System\/Library | grep -v \/usr\/lib` ; do
		/usr/bin/install_name_tool -change ${j} @executable_path/`basename ${j}` ${MACOS_TARGET}/`basename ${i}`
	done
done

# Copy .APP Icon
echo "Creating Resources target         ${RSC_TARGET}"
/usr/bin/install -d -m 755 ${RSC_TARGET}

echo "Copying icon from                 ${ICONS_DIR}"
/usr/bin/install -m 644 ${ICONS_DIR}/icon_128x128.icns ${RSC_TARGET}/${BUNDLE_NAME}.icns

# Make the distribution disk image
echo "Making the final disk image."
/usr/bin/hdiutil create -type SPARSE -size 20m -fs HFS+ -volname "${DMG_TARGET}" -attach ${PROG_NAME}-${APP_VERSION}.sparseimage

#/usr/bin/hdiutil attach ${PROG_NAME}-${APP_VERSION}.sparseimage

echo "Copying files into the disk image."

/bin/cp -R ${BUNDLE_NAME}.app /Volumes/"${DMG_TARGET}"
/bin/cp ${PROG_NAME}/icons/ValknutVolumeIcon.icns /Volumes/"${DMG_TARGET}"/.VolumeIcon.icns
/Developer/Tools/SetFile -a C /Volumes/"${DMG_TARGET}"/.VolumeIcon.icns /Volumes/"${DMG_TARGET}"

/usr/bin/hdiutil unmount /Volumes/"${DMG_TARGET}"

/usr/bin/hdiutil convert -imagekey zlib-level=9 -format UDZO ${PROG_NAME}-${APP_VERSION}.sparseimage -o ${PROG_NAME}-${APP_VERSION}.dmg

/bin/rm -f ${PROG_NAME}-${APP_VERSION}.sparseimage

echo ""
echo "Done building a distributable disk image for ${BUNDLE_NAME}."
echo "The disk image can be found at the root of the"
echo "build directory `pwd`"
echo "as '${PROG_NAME}-${APP_VERSION}.dmg'."