~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to mac/Makefile.jingle

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Build file for packaging Psi/Mac.
 
3
#
 
4
# The DMG packager looks for a template.dmg.bz2 for using as its 
 
5
# DMG template. If it doesn't find one, it generates a clean one.
 
6
#
 
7
# If you create a DMG template, you should make one containing all
 
8
# the files listed in $(FILES) below, and arrange everything to suit
 
9
# your style. The contents of the files themselves does not matter, so
 
10
# they can be empty. 
 
11
#
 
12
# Parameters:
 
13
#       * BUILD: Set this to 'no' if you do not want to build the source tree or
 
14
#               check dependencies of the 'disk' dir when building the DMG.
 
15
#
 
16
# Remko Troncon <remko@psi-im.org>
 
17
#
 
18
 
 
19
# Change these according to your own setup
 
20
QTDIR=/Developer/qt-4.1.2-universal
 
21
QCADIR=$(QTDIR)
 
22
GROWLDIR=/Library/Frameworks
 
23
PSI_DIR=..
 
24
 
 
25
# Jingle variables
 
26
EXPATDIR=/sw
 
27
SPEEXDIR=/sw
 
28
ILBCDIR=/usr/local/ilbc
 
29
ORTPDIR=/usr/local/ortp
 
30
GLIBDIR=/sw
 
31
GLIB_LIBS=libgmodule-2.0.0 libgthread-2.0.0 libglib-2.0.0 libiconv.2 libintl.1
 
32
 
 
33
 
 
34
NAME=Psi
 
35
#VERSION=Qt4_devel_$(shell date +"%Y%m%d")
 
36
VERSION=beta2
 
37
FILES=Psi.app 
 
38
DISK_DIR=disk
 
39
ifneq ($(BUILD),no)
 
40
DISK_FILES=$(foreach f,$(FILES), $(addprefix $(DISK_DIR)/,$(f)))
 
41
endif
 
42
MASTER_DMG=$(NAME)-$(VERSION).dmg
 
43
 
 
44
 
 
45
# Other variables
 
46
QT_FRAMEWORK_VERSION=4.0
 
47
QT_FRAMEWORKS=QtCore QtXml QtNetwork QtGui QtSql Qt3Support
 
48
 
 
49
# The rules
 
50
.PHONY: buildall
 
51
all: build-psi $(DISK_FILES)
 
52
 
 
53
.PHONY: dmg
 
54
dmg: build-psi $(DISK_FILES) $(MASTER_DMG)
 
55
 
 
56
# Cleanup
 
57
.PHONY: clean
 
58
clean: clean-dmg
 
59
        -rm -rf $(DISK_DIR)
 
60
 
 
61
# Help
 
62
.PHONY: help
 
63
help:
 
64
        @echo "Usage:"
 
65
        @echo "    make : Build a distributable binary in $(DISK_DIR)/"
 
66
        @echo "    make dmg : Build a DMG disk image"
 
67
 
 
68
# Building the main source tree
 
69
.PHONY: build-psi
 
70
ifneq ($(BUILD),no)
 
71
build-psi:
 
72
        @echo
 
73
        @echo --------------------- Building Source Tree --------------------
 
74
        $(MAKE) -C $(PSI_DIR)
 
75
        @echo
 
76
else
 
77
build-psi:
 
78
endif
 
79
 
 
80
 
 
81
################################################################################
 
82
# Generation of the final files
 
83
################################################################################
 
84
 
 
85
# The binary
 
86
$(DISK_DIR)/Psi.app: $(PSI_DIR)/src/psi.app
 
87
        @echo
 
88
        @echo --------------------- Packaging Binary --------------------
 
89
        rm -rf "$@"
 
90
        ditto -rsrc "$<" "$@"
 
91
        mkdir -p "$@/Contents/Frameworks"
 
92
        -ditto -rsrc "$(GROWLDIR)/Growl.framework" "$@/Contents/Frameworks/Growl.framework"
 
93
        strip "$@/Contents/MacOS/psi"
 
94
        #
 
95
        @echo
 
96
        @echo Installing QCA ...
 
97
        cp -f "$(QCADIR)/lib/libqca.2.dylib" "$@/Contents/Frameworks/"
 
98
        install_name_tool -id "@executable_path/../Frameworks/libqca.2.dylib" "$@/Contents/Frameworks/libqca.2.dylib"
 
99
        install_name_tool -change "libqca.2.dylib" "@executable_path/../Frameworks/libqca.2.dylib" "$@/Contents/MacOS/psi"
 
100
        mkdir -p "$@/Contents/Resources/crypto"
 
101
        cp -f "$(QTDIR)/plugins/crypto/libqca-openssl.dylib" "$@/Contents/Resources/crypto/"
 
102
        install_name_tool -change "libqca.2.dylib" "@executable_path/../Frameworks/libqca.2.dylib" "$@/Contents/Resources/crypto/libqca-openssl.dylib"
 
103
        mkdir -p "$@/Contents/Resources/imageformats"
 
104
        cp -f "$(QTDIR)/plugins/imageformats/libqjpeg.dylib" "$@/Contents/Resources/imageformats/"
 
105
        #
 
106
        @echo
 
107
        @echo Installing Qt Frameworks ...
 
108
        for f in $(QT_FRAMEWORKS); do \
 
109
                ditto -rsrc "$(QTDIR)/lib/$$f.framework" "$@/Contents/Frameworks/$$f.framework"; \
 
110
                rm -rf "$@/Contents/Frameworks/$$f.framework/Headers"; \
 
111
                rm -rf "$@/Contents/Frameworks/$$f.framework/$$f""_debug"; \
 
112
                rm -rf "$@/Contents/Frameworks/$$f.framework/$$f""_debug.prl"; \
 
113
                rm -rf "$@/Contents/Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/Headers"; \
 
114
                rm -rf "$@/Contents/Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f""_debug"; \
 
115
                rm -rf "$@/Contents/Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f""_debug.prl"; \
 
116
                install_name_tool -id "@executable_path/../Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "$@/Contents/Frameworks/$$f.framework/$$f"; \
 
117
                for g in $(QT_FRAMEWORKS); do \
 
118
                        install_name_tool -change "$(QTDIR)/lib/$$g.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$g" "@executable_path/../Frameworks/$$g.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$g" "$@/Contents/Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f"; \
 
119
                done; \
 
120
                install_name_tool -change "$(QTDIR)/lib/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "@executable_path/../Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "$@/Contents/Frameworks/libqca.2.dylib"; \
 
121
                install_name_tool -change "$(QTDIR)/lib/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "@executable_path/../Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "$@/Contents/Resources/crypto/libqca-openssl.dylib"; \
 
122
                install_name_tool -change "$(QTDIR)/lib/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "@executable_path/../Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "$@/Contents/Resources/imageformats/libqjpeg.dylib"; \
 
123
                install_name_tool -change "$(QTDIR)/lib/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "@executable_path/../Frameworks/$$f.framework/Versions/$(QT_FRAMEWORK_VERSION)/$$f" "$@/Contents/MacOS/psi"; \
 
124
        done
 
125
        @echo
 
126
        @echo Installing Jingle libs ...
 
127
        cp -f "$(EXPATDIR)/lib/libexpat.0.dylib" "$@/Contents/Frameworks/"
 
128
        install_name_tool -id "@executable_path/../Frameworks/libexpat.0.dylib" "$@/Contents/Frameworks/libexpat.0.dylib"
 
129
        install_name_tool -change "$(EXPATDIR)/lib/libexpat.0.dylib" "@executable_path/../Frameworks/libexpat.0.dylib" "$@/Contents/MacOS/psi"
 
130
        cp -f "$(SPEEXDIR)/lib/libspeex.1.dylib" "$@/Contents/Frameworks/"
 
131
        install_name_tool -id "@executable_path/../Frameworks/libspeex.1.dylib" "$@/Contents/Frameworks/libspeex.1.dylib"
 
132
        install_name_tool -change "$(SPEEXDIR)/lib/libspeex.1.dylib" "@executable_path/../Frameworks/libspeex.1.dylib" "$@/Contents/MacOS/psi"
 
133
        cp -f "$(ILBCDIR)/lib/libilbc.0.dylib" "$@/Contents/Frameworks/"
 
134
        install_name_tool -id "@executable_path/../Frameworks/libilbc.0.dylib" "$@/Contents/Frameworks/libilbc.0.dylib"
 
135
        install_name_tool -change "$(ILBCDIR)/lib/libilbc.0.dylib" "@executable_path/../Frameworks/libilbc.0.dylib" "$@/Contents/MacOS/psi"
 
136
        cp -f "$(ORTPDIR)/lib/libortp.0.dylib" "$@/Contents/Frameworks/"
 
137
        install_name_tool -id "@executable_path/../Frameworks/libortp.0.dylib" "$@/Contents/Frameworks/libortp.0.dylib"
 
138
        install_name_tool -change "$(ORTPDIR)/lib/libortp.0.dylib" "@executable_path/../Frameworks/libortp.0.dylib" "$@/Contents/MacOS/psi"
 
139
        for f in $(GLIB_LIBS); do \
 
140
                cp -f "$(GLIBDIR)/lib/$$f.dylib" "$@/Contents/Frameworks/"; \
 
141
                install_name_tool -id "@executable_path/../Frameworks/$$f.dylib" "$@/Contents/Frameworks/$$f.dylib"; \
 
142
                install_name_tool -change "$(GLIBDIR)/lib/$$f.dylib" "@executable_path/../Frameworks/$$f.dylib" "$@/Contents/MacOS/psi"; \
 
143
                install_name_tool -change "$(GLIBDIR)/lib/$$f.dylib" "@executable_path/../Frameworks/$$f.dylib" "$@/Contents/Frameworks/libortp.0.dylib"; \
 
144
                for g in $(GLIB_LIBS); do \
 
145
                        install_name_tool -change "$(GLIBDIR)/lib/$$g.dylib" "@executable_path/../Frameworks/$$g.dylib" "$@/Contents/Frameworks/$$f.dylib"; \
 
146
                done; \
 
147
        done
 
148
 
 
149
 
 
150
# The rest
 
151
$(DISK_DIR)/%: $(PSI_DIR)/%
 
152
        ditto -rsrc "$<" $@
 
153
 
 
154
 
 
155
################################################################################
 
156
# Disk image creation
 
157
################################################################################
 
158
 
 
159
WC_DMG=wc.dmg
 
160
WC_DIR=wc
 
161
TEMPLATE_DMG=template.dmg
 
162
 
 
163
$(TEMPLATE_DMG): $(TEMPLATE_DMG).bz2
 
164
        bunzip2 -k $<
 
165
 
 
166
$(TEMPLATE_DMG).bz2: 
 
167
        @echo
 
168
        @echo --------------------- Generating empty template --------------------
 
169
        mkdir template
 
170
        hdiutil create -size 80m "$(TEMPLATE_DMG)" -srcfolder template -format UDRW -volname "$(NAME)" -quiet
 
171
        rmdir template
 
172
        bzip2 "$(TEMPLATE_DMG)"
 
173
        @echo
 
174
 
 
175
$(WC_DMG): $(TEMPLATE_DMG)
 
176
        cp $< $@
 
177
 
 
178
$(MASTER_DMG): $(WC_DMG) $(DISK_FILES)
 
179
        @echo
 
180
        @echo --------------------- Creating Disk Image --------------------
 
181
        mkdir -p $(WC_DIR)
 
182
        hdiutil attach "$(WC_DMG)" -noautoopen -quiet -mountpoint "$(WC_DIR)"
 
183
        for i in $(DISK_DIR)/*; do  \
 
184
                file=`basename $$i`; \
 
185
                rm -rf "$(WC_DIR)/$$file"; \
 
186
                ditto -rsrc "$(DISK_DIR)/$$file" "$(WC_DIR)/$$file"; \
 
187
        done
 
188
        #rm -f "$@"
 
189
        #hdiutil create -srcfolder "$(WC_DIR)" -format UDZO -imagekey zlib-level=9 "$@" -volname "$(NAME) $(VERSION)" -scrub -quiet
 
190
        WC_DEV=`hdiutil info | grep "$(WC_DIR)" | grep "Apple_HFS" | awk '{print $$1}'` && \
 
191
        hdiutil detach $$WC_DEV -quiet -force
 
192
        rm -f "$(MASTER_DMG)"
 
193
        hdiutil convert "$(WC_DMG)" -quiet -format UDZO -imagekey zlib-level=9 -o "$@"
 
194
        rm -rf $(WC_DIR)
 
195
        -hdiutil internet-enable -yes -quiet "$@"
 
196
        @echo
 
197
 
 
198
.PHONY: clean-dmg
 
199
clean-dmg:
 
200
        -rm -rf $(TEMPLATE_DMG) $(MASTER_DMG) $(WC_DMG) $(NAME)-*.dmg
 
201