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