scripts/release-mac
author insilmaril
Tue, 10 Apr 2007 13:22:51 +0000
changeset 446 c56ce5d81cc3
parent 399 190b3a70fabc
permissions -rwxr-xr-x
1.8.71 Basic support for macros
insilmaril@399
     1
#!/bin/bash
insilmaril@399
     2
#
insilmaril@399
     3
# Link application bundle to QT as framework
insilmaril@399
     4
#
insilmaril@399
     5
# written by Uwe Drechsel (c) 2006
insilmaril@399
     6
#
insilmaril@399
     7
# License GPL 2
insilmaril@399
     8
#
insilmaril@399
     9
insilmaril@399
    10
APPNAME=vym
insilmaril@399
    11
BUNDLE=$APPNAME.app
insilmaril@399
    12
FWORKS=$BUNDLE/Contents/Frameworks
insilmaril@399
    13
QTDIR=/usr/local/Trolltech/Qt-4.2.0
insilmaril@399
    14
QTLIB=$QTDIR/lib
insilmaril@399
    15
insilmaril@399
    16
declare -a FWLIST
insilmaril@399
    17
insilmaril@399
    18
function cleanup
insilmaril@399
    19
{
insilmaril@399
    20
	echo ***Cleaning up...
insilmaril@399
    21
	rm -rf $BUNDLE
insilmaril@399
    22
	make clean
insilmaril@399
    23
}
insilmaril@399
    24
insilmaril@399
    25
function compile
insilmaril@399
    26
{
insilmaril@399
    27
	echo ***Compiling...
insilmaril@399
    28
	qmake -config release
insilmaril@399
    29
	make
insilmaril@399
    30
}
insilmaril@399
    31
insilmaril@399
    32
function fixLinking 
insilmaril@399
    33
{
insilmaril@399
    34
	echo  ***Setting identification names...
insilmaril@399
    35
	for i in ${FWLIST[@]}
insilmaril@399
    36
	do
insilmaril@399
    37
		COM="install_name_tool -id @executable_path/../Frameworks/$i.framework/Versions/4/$i $BUNDLE/Contents/Frameworks/$i.framework/Versions/4/$i"
insilmaril@399
    38
	done	
insilmaril@399
    39
		echo "   $COM"
insilmaril@399
    40
		`$COM`
insilmaril@399
    41
insilmaril@399
    42
	echo ***Tell dynamic linker where to look for frameworks... 
insilmaril@399
    43
	for i in ${FWLIST[@]}
insilmaril@399
    44
	do
insilmaril@399
    45
		COM="install_name_tool -change $QTLIB/$i.framework/Versions/4/$i @executable_path/../Frameworks/$i.framework/Versions/4/$i $BUNDLE/Contents/MacOs/$APPNAME"
insilmaril@399
    46
		echo "   $COM"
insilmaril@399
    47
		`$COM`
insilmaril@399
    48
	done	
insilmaril@399
    49
insilmaril@399
    50
insilmaril@399
    51
	for fw in ${FWLIST[@]}
insilmaril@399
    52
	do
insilmaril@399
    53
	echo ***Adjust dynamic linking in $fw
insilmaril@399
    54
		for i in ` otool -L vym.app/Contents/Frameworks/$fw.framework/$fw | grep Trolltech | sed "s/^.*\///" | sed "s/ .*$//"` 
insilmaril@399
    55
		do
insilmaril@399
    56
			COM="install_name_tool -change $QTLIB/$i.framework/Versions/4/$i @executable_path/../Frameworks/$i.framework/Versions/4/$i $FWORKS/$fw.framework/$fw"
insilmaril@399
    57
			echo "   $COM"
insilmaril@399
    58
			`$COM`
insilmaril@399
    59
		done	
insilmaril@399
    60
	done
insilmaril@399
    61
insilmaril@399
    62
}
insilmaril@399
    63
insilmaril@399
    64
function copyFrameworks
insilmaril@399
    65
{
insilmaril@399
    66
	# Copy found frameworks into bundle, preserve symbolic links with -R
insilmaril@399
    67
	mkdir -p  $FWORKS
insilmaril@399
    68
	for i in ${FWLIST[@]}
insilmaril@399
    69
	do
insilmaril@399
    70
		echo ***Copying $QTLIB/$i.framework
insilmaril@399
    71
		#cp -R $QTLIB/$i.framework $FWORKS
insilmaril@399
    72
		rsync -avz $QTLIB/$i.framework $FWORKS --exclude 'Qt*_debug'
insilmaril@399
    73
	done	
insilmaril@399
    74
}
insilmaril@399
    75
insilmaril@399
    76
function copyRessources
insilmaril@399
    77
{
insilmaril@399
    78
	echo ***Copying ressources
insilmaril@399
    79
	mkdir -p $BUNDLE/Contents/Resources
insilmaril@399
    80
	cp -r icons flags scripts styles vym.app/Contents/Resources/
insilmaril@399
    81
	cp icons/vym.icns $BUNDLE/Contents/Resources
insilmaril@399
    82
}
insilmaril@399
    83
insilmaril@399
    84
function findFrameworks
insilmaril@399
    85
{
insilmaril@399
    86
	FWLIST=`otool -L $BUNDLE/Contents/MacOS/$APPNAME  | grep Trolltech | sed "s/^.*\///" | sed "s/ .*$//"`
insilmaril@399
    87
	#FWLIST=( Qt3Support QtSql QtNetwork QtXml QtGui QtCore )
insilmaril@399
    88
insilmaril@399
    89
	echo ***The following Qt frameworks are needed:
insilmaril@399
    90
	for i in ${FWLIST[@]}
insilmaril@399
    91
	do
insilmaril@399
    92
		echo $i
insilmaril@399
    93
	done	
insilmaril@399
    94
}	
insilmaril@399
    95
insilmaril@399
    96
insilmaril@399
    97
#cleanup
insilmaril@399
    98
#compile
insilmaril@399
    99
insilmaril@399
   100
insilmaril@399
   101
#findFrameworks
insilmaril@399
   102
#copyFrameworks
insilmaril@399
   103
#fixLinking
insilmaril@399
   104
copyRessources
insilmaril@399
   105