Prevent a crash if an attachment gives us a null image
[adiumx.git] / Release / Makefile
blob3c668ff4df8eb9dc85b84ea04dc3452ea04b6ccd
1 ###########
2 # What to do before running this script:
3 # - openUp needs to be installed.
4 # - Set VERSION and BETA below.
5 # The Adium and Adium Crash Reporter plists will automatically
6 # updated to match these values.
7 # - To enable beta, also edit Source/AIAdium.h, and set BETA_RELEASE to TRUE. Set it to FALSE when doing a final release.
9 # How to run this script:
10 # - make all
11 ###########
13 VERSION=1.0b19
14 BETA=TRUE
16 ###########
17 # To release!
18 # Releasing requires cachefly access and adiumx.com access.
20 # First upload to cachefly. If you don't have access and need to do a release, get with Evan or Chris (tick).
21 # Triggering the version checker once the release is up:
22 # 1) Build Adium
23 # 2) Get the number out of the 'buildnum' file in Adium.app/Contents/Resources
24 # 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 ***
25 # 4) Update and commit the appcast.xml file in the adium checkout root
26 # 5) Run the appcast update php script.
27 ###########
29 ###########
30 # No need for changes below this point
31 ###########
33 SRC_DIR=..
34 BUILD_DIR=build
35 ART_DIR=Artwork
36 ADIUM_DIR=$(BUILD_DIR)/Adium
37 RELEASE_NAME=Adium_$(VERSION)
38 ifeq ($(BETA),TRUE)
39 BUILDSTYLE=Deployment-Debug
40 else
41 BUILDSTYLE=Deployment
42 endif
43 BUILDFLAGS="BUILDCONFIGURATION=$(BUILDSTYLE)"
44 PRODUCT_DIR=$(shell defaults read com.apple.Xcode PBXProductDirectory 2> /dev/null)
45 ifeq ($(strip $(PRODUCT_DIR)),)
46 ADIUM_BUILD_DIR=$(SRC_DIR)/build/$(BUILDSTYLE)
47 else
48 TARGET_BUILD_DIR=$(PRODUCT_DIR)/$(BUILDSTYLE)
49 ADIUM_BUILD_DIR=$(TARGET_BUILD_DIR)
50 endif
51 PLIST_DIR=`pwd`/../Plists
52 ADIUM_PLIST=$(PLIST_DIR)/Adium_2
53 CRASH_REPORTER_PLIST=$(PLIST_DIR)/Adium\ Crash\ Reporter-Info
55 .PHONY: all update version compile clean release source prepare-release-bundle createfolder diskimage
57 all: update version clean compile release
59 all-noclean: update version compile release
61 update:
62 svn update $(SRC_DIR)
64 version:
65 @# update the plists
66 defaults write $(ADIUM_PLIST) CFBundleGetInfoString '$(VERSION), Copyright 2001-2007 The Adium Team'
67 defaults write $(ADIUM_PLIST) CFBundleVersion '$(VERSION)'
68 defaults write $(ADIUM_PLIST) CFBundleShortVersionString '$(VERSION)'
69 defaults write $(CRASH_REPORTER_PLIST) CFBundleGetInfoString '$(VERSION), Copyright 2001-2007 The Adium Team'
70 defaults write $(CRASH_REPORTER_PLIST) CFBundleVersion '$(VERSION)'
71 defaults write $(CRASH_REPORTER_PLIST) CFBundleShortVersionString '$(VERSION)'
72 plutil -convert xml1 $(ADIUM_PLIST).plist
73 plutil -convert xml1 $(CRASH_REPORTER_PLIST).plist
75 compile:
76 $(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)
78 testcompile:
79 $(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)
81 clean:
82 rm -rf $(BUILD_DIR)
83 $(MAKE) $(BUILDFLAGS) -C $(SRC_DIR) clean
85 release: createfolder prepare-release-bundle diskimage
87 prepare-release-bundle:
88 @# Convert all nibs to the smaller binary format
89 @echo Converting nibs to binary format...
90 find $(BUILD_DIR) -name keyedobjects.nib -print0 | xargs -0 plutil -convert binary1
92 @# delete unneeded nib files for non-beta builds
93 @echo Cleaning Adium.app for release
94 ifeq ($(BETA),FALSE)
95 find $(BUILD_DIR) \( -name classes.nib -or -name info.nib \) -type f -delete
96 endif
98 @# delete svn and backup files
99 find $(BUILD_DIR) -name ".svn" -type d -exec rm -rf {} \; -prune
100 find $(BUILD_DIR) \( -name "*~" -or -name .DS_Store \) -type f -delete
103 createfolder:
104 @# clean build directory
105 rm -rf $(BUILD_DIR)
106 mkdir $(BUILD_DIR)
108 mkdir $(ADIUM_DIR)
110 @# copy the app
111 cp -R $(ADIUM_BUILD_DIR)/Adium.app $(ADIUM_DIR)
113 @# copy the text files
114 cp $(SRC_DIR)/Changes.txt $(ADIUM_DIR)
115 cp $(SRC_DIR)/License.txt $(ADIUM_DIR)
117 @# symlink /Applications
118 ./mkalias -r /Applications $(ADIUM_DIR)/Applications
120 diskimage:
121 rm "$(BUILD_DIR)/$(RELEASE_NAME).dmg" || true
122 @# make Adium disk image
123 mkdir -p $(ADIUM_DIR)/.background
124 cp $(ART_DIR)/dmgBackground.png $(ADIUM_DIR)/.background
126 ./ensureCustomIconsExtracted $(ART_DIR)
127 ./make-diskimage.sh $(BUILD_DIR)/$(RELEASE_NAME).dmg $(ADIUM_DIR) "Adium X $(VERSION)" dmg_adium.scpt $(ART_DIR)
129 @echo Build finished. `md5 $(BUILD_DIR)/$(RELEASE_NAME).dmg`