#!/bin/sh 
#
# Link to the native OSX-Thread: http://dcgui.berlios.de/forum/viewtopic.php?t=1478
#
# install script from ravemax:
# Here is a script that creates an .app after "make all" - no "make install" required:
#
APP_NAME=dcgui.app 
TS_TO_QM=${QTDIR}/bin/lrelease 
TS_DIR=dcgui/ts 
SOUNDS_DIR=dcgui/sound
ICONS_DIR=dcgui/icons

# App dir 
if [ -e ${APP_NAME} ]; then 
rm -rf ${APP_NAME}; 
fi 
 
mkdir ${APP_NAME} 
 
# Translation files 
TRANS_DIR=${APP_NAME}/translation; 
mkdir ${TRANS_DIR}; 
 
for i in ${TS_DIR}/*.ts; do 
${TS_TO_QM} $i; 
mv ${TS_DIR}/$(basename $i ts)qm ${TRANS_DIR} 
done 

# Sounds
mkdir ${APP_NAME}/sounds

# Plugin
mkdir ${APP_NAME}/plugin

# Icons
mkdir ${APP_NAME}/icons
mkdir ${APP_NAME}/icons/user
mkdir ${APP_NAME}/icons/user/default
mkdir ${APP_NAME}/icons/emot
mkdir ${APP_NAME}/icons/emot/default
mkdir ${APP_NAME}/icons/appl
mkdir ${APP_NAME}/icons/appl/default

cp ${ICONS_DIR}/*.xpm ${APP_NAME}/icons/appl/default
cp ${ICONS_DIR}/*.xml ${APP_NAME}/icons/appl/default

mv ${APP_NAME}/icons/appl/default/emoticons.xml ${APP_NAME}/icons/emot/default
mv ${APP_NAME}/icons/appl/default/emoticons.xpm ${APP_NAME}/icons/emot/default

mv ${APP_NAME}/icons/appl/default/usericons.xml ${APP_NAME}/icons/user/default
mv ${APP_NAME}/icons/appl/default/usericons.xpm ${APP_NAME}/icons/user/default

# Contents 
CNT_DIR=${APP_NAME}/Contents; 
mkdir ${CNT_DIR}; 
echo "APPL????" > ${CNT_DIR}/PkgInfo 
cp ${QTDIR}/mkspecs/macx-g++/Info.plist.app ${CNT_DIR}/Info.plist 
MACOS_DIR=${CNT_DIR}/MacOS; 
mkdir ${MACOS_DIR} 
cp dcgui/dcgui-qt ${MACOS_DIR}/dcgui 
 
# Resources 
RSC_DIR=${CNT_DIR}/Resources 
mkdir ${RSC_DIR}
