|
David@0
|
1 |
########### |
|
David@0
|
2 |
# What to do before running this script: |
|
David@0
|
3 |
# - openUp needs to be installed. |
|
David@0
|
4 |
# - Set VERSION, BUILD_IN_DEBUG_MODE, BETA, and OFFICIAL_BUILD below. |
|
David@0
|
5 |
# * The Adium plists will automatically updated to match these values. |
|
David@0
|
6 |
# * BETA should be TRUE for all beta builds and FALSE for all releases. |
|
David@0
|
7 |
# It primarily affects the appcast used by Adium for detecting updates. |
|
David@0
|
8 |
# * BUILD_IN_DEBUG_MODE should be set to FALSE for the last beta |
|
David@0
|
9 |
# in addition to the release itself. If FALSE, debug logging is disabled |
|
David@0
|
10 |
# and certain space optimizations for nibs and strings are done which |
|
David@0
|
11 |
# also prevent modification. |
|
David@0
|
12 |
# * OFFICIAL_BUILD is TRUE for the benefit of our Adium build machine, which signs |
|
David@0
|
13 |
# official release builds. When building a release yourself, set this to FALSE, |
|
David@0
|
14 |
# since you don't have the Adium certificate on your machine. |
|
David@0
|
15 |
# |
|
David@0
|
16 |
# How to run this script: |
|
David@0
|
17 |
# - make all |
|
David@0
|
18 |
########### |
|
David@0
|
19 |
|
|
Eric@4517
|
20 |
VERSION=1.5rc1 |
|
David@0
|
21 |
BUILD_IN_DEBUG_MODE?=TRUE |
|
zacw@2237
|
22 |
BETA?=TRUE |
|
zacw@2241
|
23 |
OFFICIAL_BUILD?=TRUE |
|
David@0
|
24 |
|
|
David@0
|
25 |
# Always builds in debug mode. |
|
David@0
|
26 |
NIGHTLY?=FALSE |
|
robotive@4075
|
27 |
NIGHTLY_REPO?=adium #change to adium-1.4 on the 1.4 branch |
|
robotive@4075
|
28 |
NIGHTLY_BRANCH?=default |
|
David@0
|
29 |
|
|
David@0
|
30 |
########### |
|
David@0
|
31 |
# To release! |
|
David@0
|
32 |
# Releasing requires cachefly access and adiumx.com access. |
|
David@0
|
33 |
# |
|
David@0
|
34 |
# First upload to cachefly. If you don't have access and need to do a release, get with Evan or Chris (tick). |
|
David@0
|
35 |
# Triggering the version checker once the release is up: |
|
David@0
|
36 |
# 1) Build Adium |
|
David@0
|
37 |
# 2) Get the number out of the 'buildnum' file in Adium.app/Contents/Resources |
|
David@0
|
38 |
# 3) Paste that number into the appropriate place (adium version or adium-beta version, depending on which you're triggering) in the version.plist file in our public_html folder. *** (2) and (3) are to support the old version checker, in Adium 0.8x and earlier *** |
|
David@0
|
39 |
# 4) Update and commit the appcast.xml file in the adium checkout root |
|
David@0
|
40 |
# 5) Run the appcast update php script. |
|
David@0
|
41 |
########### |
|
David@0
|
42 |
|
|
David@0
|
43 |
########### |
|
David@0
|
44 |
# No need for changes below this point |
|
David@0
|
45 |
########### |
|
David@0
|
46 |
|
|
David@0
|
47 |
########### |
|
David@0
|
48 |
# Variables |
|
David@0
|
49 |
########### |
|
David@0
|
50 |
SRC_DIR=.. |
|
David@0
|
51 |
BUILD_DIR=build |
|
David@0
|
52 |
ART_DIR=Artwork |
|
David@0
|
53 |
ADIUM_DIR=$(BUILD_DIR)/Adium |
|
David@0
|
54 |
RELEASE_NAME=Adium_$(VERSION) |
|
David@0
|
55 |
VERSION_ESCAPED=$(VERSION) |
|
David@0
|
56 |
RELEASE_NAME_ESCAPED=Adium_$(VERSION_ESCAPED) |
|
David@0
|
57 |
TARBALL_DIR=adium-$(VERSION) |
|
David@0
|
58 |
|
|
zacw@2107
|
59 |
REVISION = r$(shell hg parent --template {rev}) |
|
zacw@1787
|
60 |
|
|
David@0
|
61 |
ifeq ($(NIGHTLY),TRUE) |
|
zacw@2239
|
62 |
BETA=FALSE |
|
zacw@1787
|
63 |
ADIUM_DIR:=$(ADIUM_DIR)\ $(REVISION) |
|
zacw@1787
|
64 |
VERSION_ESCAPED:=$(VERSION_ESCAPED)\ $(REVISION) |
|
zacw@1787
|
65 |
VERSION:=$(VERSION)$(REVISION) |
|
David@0
|
66 |
BUILD_IN_DEBUG_MODE=TRUE |
|
David@0
|
67 |
BUILDFLAGS+="ADIUM_CFLAGS=-DNIGHTLY_RELEASE" |
|
robotive@4481
|
68 |
BUILDFLAGS+="ADIUM_NIGHTLY_FLAGS=CACHE_ROOT=/var/tmp/buildbot/com.apple.Xcode.$(strip $(shell id -u))/nightly/$(strip $(NIGHTLY_REPO))/$(strip $(NIGHTLY_BRANCH))" # Required, otherwise wrong precompiled headers are used. |
|
David@0
|
69 |
endif |
|
David@0
|
70 |
|
|
David@0
|
71 |
ifeq ($(BUILD_IN_DEBUG_MODE),TRUE) |
|
Peter@59
|
72 |
BUILDSTYLE=Release-Debug |
|
David@0
|
73 |
else |
|
Peter@59
|
74 |
BUILDSTYLE=Release |
|
David@0
|
75 |
endif |
|
David@0
|
76 |
|
|
David@0
|
77 |
BUILDFLAGS+="BUILDCONFIGURATION=$(BUILDSTYLE)" |
|
robotive@4480
|
78 |
|
|
David@0
|
79 |
ifeq ($(BETA),TRUE) |
|
David@0
|
80 |
BUILDFLAGS+="ADIUM_CFLAGS=-DBETA_RELEASE" |
|
David@0
|
81 |
endif |
|
David@0
|
82 |
|
|
hg@2456
|
83 |
PRODUCT_DIR=$(shell defaults read com.apple.Xcode PBXApplicationwideBuildSettings 2> /dev/null > XcodeBuildSettings.plist && defaults read $PWD/XcodeBuildSettings SYMROOT 2> /dev/null; rm XcodeBuildSettings.plist) |
|
David@0
|
84 |
|
|
David@0
|
85 |
ifeq ($(strip $(PRODUCT_DIR)),) |
|
David@0
|
86 |
ADIUM_BUILD_DIR=$(SRC_DIR)/build/$(BUILDSTYLE) |
|
David@0
|
87 |
else |
|
David@0
|
88 |
TARGET_BUILD_DIR=$(PRODUCT_DIR)/$(BUILDSTYLE) |
|
David@0
|
89 |
ADIUM_BUILD_DIR=$(TARGET_BUILD_DIR) |
|
David@0
|
90 |
endif |
|
David@0
|
91 |
|
|
David@0
|
92 |
PLIST_DIR=`pwd`/../Plists |
|
David@0
|
93 |
ADIUM_PLIST=$(PLIST_DIR)/Info |
|
David@0
|
94 |
|
|
David@0
|
95 |
########### |
|
David@0
|
96 |
# Targets |
|
David@0
|
97 |
########### |
|
zacw@1341
|
98 |
.PHONY: all all-withlocalchanges all-withlocalchanges-noclean all-nopackage-noclean all-nightly update assertnochanges assertnoconflicts version compile clean release source prepare-release-bundle createfolder diskimage nightly tarball |
|
David@0
|
99 |
|
|
David@0
|
100 |
all: update assertnochanges version clean compile release |
|
David@0
|
101 |
all-withlocalchanges: update assertnoconflicts version clean compile release |
|
David@0
|
102 |
all-withlocalchanges-noclean: update assertnoconflicts version compile release |
|
David@0
|
103 |
|
|
David@0
|
104 |
#doesn't bother putting things in a dmg |
|
David@0
|
105 |
#useful for builds not intended for distribution |
|
zacw@1341
|
106 |
all-nopackage-noclean: update assertnoconflicts version compile createfolder prepare-release-bundle |
|
David@0
|
107 |
|
|
David@0
|
108 |
update: |
|
zacwest@1790
|
109 |
hg pull -uf |
|
David@0
|
110 |
|
|
David@0
|
111 |
assertnochanges: assertnoconflicts |
|
zacwest@1790
|
112 |
if [[ 0 -ne `hg st $(SRC_DIR) | egrep --invert-match '\?|Info\.plist' | wc -l` ]]; then \ |
|
David@0
|
113 |
echo 'You have local changes. Please do not build releases from an unclean checkout. You must revert the changes, commit them, or check out another working copy and build from that.' 1>&2; \ |
|
David@0
|
114 |
exit 1; \ |
|
David@0
|
115 |
fi |
|
David@0
|
116 |
assertnoconflicts: |
|
zacwest@1790
|
117 |
if [[ 0 -ne `hg st $(SRC_DIR) | egrep '^C' | wc -l` ]]; then \ |
|
zacwest@1790
|
118 |
echo 'You have conflicts in your checkout. You will not be able to build until these are resolved. Also, remember that even after you have fixed all conflict marks, you must use "hg resolve"; otherwise, hg will still believe the files are conflicted.' 1>&2; \ |
|
David@0
|
119 |
exit 2; \ |
|
David@0
|
120 |
fi |
|
David@0
|
121 |
|
|
David@0
|
122 |
version: |
|
David@0
|
123 |
@# update the plists |
|
robotive@4075
|
124 |
defaults write $(ADIUM_PLIST) CFBundleGetInfoString "$(VERSION), Copyright 2001-$(shell date +"%Y") The Adium Team" |
|
David@0
|
125 |
defaults write $(ADIUM_PLIST) CFBundleVersion "$(VERSION)" |
|
David@0
|
126 |
defaults write $(ADIUM_PLIST) CFBundleShortVersionString "$(VERSION)" |
|
robotive@4075
|
127 |
ifeq ($(NIGHTLY),TRUE) |
|
robotive@4077
|
128 |
defaults write $(ADIUM_PLIST) AINightlyRepo "$(NIGHTLY_REPO)" |
|
robotive@4077
|
129 |
defaults write $(ADIUM_PLIST) AINightlyBranch "$(NIGHTLY_BRANCH)" |
|
robotive@4078
|
130 |
endif |
|
David@0
|
131 |
plutil -convert xml1 $(ADIUM_PLIST).plist |
|
David@0
|
132 |
|
|
David@0
|
133 |
compile: |
|
David@0
|
134 |
$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR) |
|
David@0
|
135 |
|
|
David@0
|
136 |
testcompile: |
|
David@0
|
137 |
$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR) |
|
David@0
|
138 |
|
|
David@0
|
139 |
clean: |
|
David@0
|
140 |
rm -rf $(BUILD_DIR) |
|
David@0
|
141 |
$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR) clean |
|
David@0
|
142 |
|
|
zacw@1341
|
143 |
release: createfolder prepare-release-bundle diskimage |
|
David@0
|
144 |
|
|
David@0
|
145 |
prepare-release-bundle: |
|
David@0
|
146 |
@# Convert all nibs to the smaller binary format |
|
David@0
|
147 |
@echo Converting nibs to binary format... |
|
David@0
|
148 |
find $(BUILD_DIR) -name keyedobjects.nib -print0 | xargs -0 plutil -convert binary1 |
|
David@0
|
149 |
|
|
David@0
|
150 |
@# delete unneeded nib files for non-beta builds |
|
David@0
|
151 |
@echo Cleaning Adium.app for release |
|
David@0
|
152 |
ifeq ($(BUILD_IN_DEBUG_MODE),FALSE) |
|
Smew@3098
|
153 |
find $(BUILD_DIR) \( -name classes.nib -or -name info.nib -or -name designable.nib \) -type f -delete |
|
David@0
|
154 |
endif |
|
robotive@4075
|
155 |
|
|
zacwest@1790
|
156 |
@# delete backup files |
|
David@0
|
157 |
find $(BUILD_DIR) \( -name "*~" -or -name .DS_Store \) -type f -delete |
|
robotive@4075
|
158 |
|
|
catfish@1807
|
159 |
@# delete header files |
|
zacw@1843
|
160 |
find $(BUILD_DIR) \( -name "*.h" \) -type f -delete |
|
David@0
|
161 |
|
|
David@0
|
162 |
@# sign the executable |
|
David@0
|
163 |
ifeq ($(OFFICIAL_BUILD),TRUE) |
|
David@0
|
164 |
if [ -e ~/adium-password ]; then \ |
|
David@0
|
165 |
security unlock-keychain -p `cat ~/adium-password`; \ |
|
David@0
|
166 |
fi |
|
David@0
|
167 |
codesign -v -s Adium $(ADIUM_DIR)/Adium.app/Contents/MacOS/Adium |
|
David@0
|
168 |
endif |
|
David@0
|
169 |
|
|
David@0
|
170 |
createfolder: |
|
David@0
|
171 |
@# clean build directory |
|
David@0
|
172 |
rm -rf $(BUILD_DIR) |
|
David@0
|
173 |
mkdir $(BUILD_DIR) |
|
David@0
|
174 |
|
|
David@0
|
175 |
mkdir $(ADIUM_DIR) |
|
robotive@4075
|
176 |
|
|
David@0
|
177 |
@# copy the app |
|
hg@2455
|
178 |
cp -R "$(ADIUM_BUILD_DIR)/Adium.app" $(ADIUM_DIR) |
|
David@0
|
179 |
|
|
David@0
|
180 |
@# copy the text files |
|
David@0
|
181 |
cp $(SRC_DIR)/ChangeLogs/Changes.txt $(ADIUM_DIR) |
|
David@0
|
182 |
cp $(SRC_DIR)/License.txt $(ADIUM_DIR) |
|
robotive@4075
|
183 |
|
|
David@0
|
184 |
@# symlink /Applications |
|
David@0
|
185 |
./mkalias -r /Applications $(ADIUM_DIR)/Applications |
|
David@0
|
186 |
|
|
David@0
|
187 |
diskimage: |
|
David@0
|
188 |
rm "$(BUILD_DIR)/$(RELEASE_NAME).dmg" || true |
|
David@0
|
189 |
@# make Adium disk image |
|
David@0
|
190 |
mkdir -p $(ADIUM_DIR)/.background |
|
David@0
|
191 |
cp $(ART_DIR)/dmgBackground.png $(ADIUM_DIR)/.background |
|
David@0
|
192 |
|
|
David@0
|
193 |
./ensureCustomIconsExtracted $(ART_DIR) |
|
zacw@2073
|
194 |
./make-diskimage.sh $(BUILD_DIR)/$(RELEASE_NAME).dmg $(ADIUM_DIR) "Adium $(VERSION)" dmg_adium.scpt $(ART_DIR) |
|
robotive@4075
|
195 |
|
|
zacw@1329
|
196 |
ifeq ($(OFFICIAL_BUILD),TRUE) |
|
zacw@1338
|
197 |
@echo DSA for Sparkle: `ruby sign_update.rb $(BUILD_DIR)/$(RELEASE_NAME_ESCAPED).dmg ~/adium-dsa-sign/dsa_priv.pem` |
|
zacw@1329
|
198 |
endif |
|
zacw@1329
|
199 |
|
|
David@0
|
200 |
@echo Build finished. `md5 $(BUILD_DIR)/$(RELEASE_NAME_ESCAPED).dmg` |
|
David@0
|
201 |
|
|
David@0
|
202 |
#This is what nightly builds use. Does not update because buildbot does. |
|
zacw@2071
|
203 |
nightly: version clean compile createfolder prepare-release-bundle diskimage |
|
zacw@1976
|
204 |
echo $(RELEASE_NAME) > $(BUILD_DIR)/latest.info |
|
zacw@1976
|
205 |
echo $(REVISION) >> $(BUILD_DIR)/latest.info |
|
zacw@2071
|
206 |
md5 -q $(BUILD_DIR)/$(RELEASE_NAME).dmg >> $(BUILD_DIR)/latest.info |
|
zacw@2071
|
207 |
md5 -q $(BUILD_DIR)/$(RELEASE_NAME).dmg >> $(BUILD_DIR)/$(RELEASE_NAME).dmg.md5 |
|
zacw@2071
|
208 |
ls -l $(BUILD_DIR)/$(RELEASE_NAME).dmg | awk '{print $$5}' >>$(BUILD_DIR)/latest.info |
|
zacw@1976
|
209 |
echo $(VERSION) >> $(BUILD_DIR)/latest.info |
|
zacw@1340
|
210 |
ifeq ($(OFFICIAL_BUILD),TRUE) |
|
zacw@2071
|
211 |
ruby sign_update.rb $(BUILD_DIR)/$(RELEASE_NAME).dmg ~/adium-dsa-sign/dsa_priv.pem >> $(BUILD_DIR)/latest.info |
|
zacw@1340
|
212 |
endif |
|
zacw@1316
|
213 |
|
|
zacw@1316
|
214 |
tarballapp: |
|
zacw@1848
|
215 |
rm $(BUILD_DIR)/$(RELEASE_NAME).tgz || true |
|
zacwest@1790
|
216 |
cd $(BUILD_DIR) && tar zcf $(RELEASE_NAME).tgz Adium*/ && cd .. |
|
David@0
|
217 |
|
|
David@0
|
218 |
tarball: |
|
robotive@4075
|
219 |
hg archive -t tgz ($TARBALL_DIR).tgz |