2
# Build file for packaging Psi/Mac.
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.
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
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.
16
# Remko Troncon <remko@psi-im.org>
19
# Change these according to your own setup
20
QTDIR=/Developer/qt-4.1.2-universal
22
GROWLDIR=/Library/Frameworks
28
ILBCDIR=/usr/local/ilbc
29
ORTPDIR=/usr/local/ortp
31
GLIB_LIBS=libgmodule-2.0.0 libgthread-2.0.0 libglib-2.0.0 libiconv.2 libintl.1
35
#VERSION=Qt4_devel_$(shell date +"%Y%m%d")
40
DISK_FILES=$(foreach f,$(FILES), $(addprefix $(DISK_DIR)/,$(f)))
42
MASTER_DMG=$(NAME)-$(VERSION).dmg
46
QT_FRAMEWORK_VERSION=4.0
47
QT_FRAMEWORKS=QtCore QtXml QtNetwork QtGui QtSql Qt3Support
51
all: build-psi $(DISK_FILES)
54
dmg: build-psi $(DISK_FILES) $(MASTER_DMG)
65
@echo " make : Build a distributable binary in $(DISK_DIR)/"
66
@echo " make dmg : Build a DMG disk image"
68
# Building the main source tree
73
@echo --------------------- Building Source Tree --------------------
81
################################################################################
82
# Generation of the final files
83
################################################################################
86
$(DISK_DIR)/Psi.app: $(PSI_DIR)/src/psi.app
88
@echo --------------------- Packaging Binary --------------------
91
mkdir -p "$@/Contents/Frameworks"
92
-ditto -rsrc "$(GROWLDIR)/Growl.framework" "$@/Contents/Frameworks/Growl.framework"
93
strip "$@/Contents/MacOS/psi"
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/"
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"; \
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"; \
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"; \
151
$(DISK_DIR)/%: $(PSI_DIR)/%
155
################################################################################
156
# Disk image creation
157
################################################################################
161
TEMPLATE_DMG=template.dmg
163
$(TEMPLATE_DMG): $(TEMPLATE_DMG).bz2
168
@echo --------------------- Generating empty template --------------------
170
hdiutil create -size 80m "$(TEMPLATE_DMG)" -srcfolder template -format UDRW -volname "$(NAME)" -quiet
172
bzip2 "$(TEMPLATE_DMG)"
175
$(WC_DMG): $(TEMPLATE_DMG)
178
$(MASTER_DMG): $(WC_DMG) $(DISK_FILES)
180
@echo --------------------- Creating Disk Image --------------------
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"; \
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 "$@"
195
-hdiutil internet-enable -yes -quiet "$@"
200
-rm -rf $(TEMPLATE_DMG) $(MASTER_DMG) $(WC_DMG) $(NAME)-*.dmg