Release/Makefile
author Peter Hosey
Wed Apr 15 20:04:34 2009 -0700 (2009-04-15)
changeset 4196 cda6a8576c59
parent 4187 cb526735be8e
child 4197 3ac6e6d3547a
permissions -rw-r--r--
The Release Makefile now creates a third product: a tarball of the dSYM bundles. This will make it easy for anyone to download the dSYM bundles for a past release, enabling them to symbolicate crash logs.
     1 ##########################
     2 ### Versioning:
     3 ###   * Set VERSION and BETA below. BETA should be TRUE or FALSE.
     4 ###   * Update the version struct in Core/Source/GrowlApplicationController.m 
     5 ###       (needed for proper version checking)
     6 ###   * Update the version string in Extras/growlnotify/main.m
     7 #
     8 VERSION=1.1.5
     9 BETA=TRUE
    10 
    11 #
    12 #########################
    13 #
    14 # No changes should be needed below this line
    15 #
    16 #########################
    17 RELEASE_FILENAME=Growl-$(VERSION)
    18 RELEASE_NAME="Growl-$(VERSION)"
    19 RELEASE_SDK_NAME="Growl $(VERSION) SDK"
    20 
    21 SRC_DIR=$(PWD)/..
    22 BUILD_DIR=build
    23 GROWL_DIR=$(BUILD_DIR)/Growl
    24 SDK_DIR=$(BUILD_DIR)/SDK
    25 BUILDSTYLE=Deployment
    26 BUILDFLAGS="BUILDCONFIGURATION=$(BUILDSTYLE)"
    27 PRODUCT_DIR=$(shell defaults read com.apple.Xcode PBXApplicationwideBuildSettings 2> /dev/null | cat > XcodeBuildSettings.plist && defaults read $PWD/XcodeBuildSettings SYMROOT 2> /dev/null)
    28 ifeq ($(strip $(PRODUCT_DIR)),)
    29 	GROWL_BUILD_DIR=$(SRC_DIR)/build/$(BUILDSTYLE)
    30 	GROWLNOTIFY_BUILD_DIR=$(SRC_DIR)/Extras/growlnotify/build/$(BUILDSTYLE)
    31 	GROWLTUNES_BUILD_DIR=$(SRC_DIR)/Extras/GrowlTunes/build/$(BUILDSTYLE)
    32 	HARDWAREGROWLER_BUILD_DIR=$(SRC_DIR)/Extras/HardwareGrowler/build/$(BUILDSTYLE)
    33 	GROWLMAIL_BUILD_DIR=$(SRC_DIR)/Extras/GrowlMail/build/$(BUILDSTYLE)
    34 	GROWLSAFARI_BUILD_DIR=$(SRC_DIR)/Extras/GrowlSafari/build/$(BUILDSTYLE)
    35 else
    36 	TARGET_BUILD_DIR=$(PRODUCT_DIR)/$(BUILDSTYLE)
    37 	GROWL_BUILD_DIR=$(TARGET_BUILD_DIR)
    38 	GROWLNOTIFY_BUILD_DIR=$(TARGET_BUILD_DIR)
    39 	GROWLTUNES_BUILD_DIR=$(TARGET_BUILD_DIR)
    40 	HARDWAREGROWLER_BUILD_DIR=$(TARGET_BUILD_DIR)
    41 	GROWLMAIL_BUILD_DIR=$(TARGET_BUILD_DIR)
    42 	GROWLSAFARI_BUILD_DIR=$(TARGET_BUILD_DIR)
    43 endif
    44 DSYM_DIR=$(BUILD_DIR)/Growl-dSYM-$(VERSION)
    45 PACKAGE_MAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
    46 ART_DIR=Artwork
    47 
    48 #########################
    49 
    50 .PHONY: all assertnochanges assertnoconflicts compile clean release source version
    51 
    52 all: assertnochanges version compile release
    53 all-withlocalchanges: assertnoconflicts version compile release
    54 
    55 assertnochanges:
    56 	if [[ 0 -ne `hg st | wc -l` ]]; then \
    57 		echo 'You have local changes. Please do not build releases from an unclean working copy. You must revert the changes, commit them, or clone your repository and build from that.' 1>&2; \
    58 		exit 1; \
    59 	fi
    60 assertnoconflicts:
    61 	if [[ 0 -ne `hg resolve --list | grep -E '^U' | wc -l` ]]; then \
    62 		echo 'You have conflicts in your working copy. 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" to re-try your last update or merge; otherwise, hg will still believe the files are conflicted.' 1>&2; \
    63 		exit 2; \
    64 	fi
    65 
    66 version:
    67 	@# update the CFBundleVersion
    68 	defaults write $(SRC_DIR)/Core/Resources/GrowlHelperApp-Info CFBundleVersion '$(VERSION)'
    69 	defaults write $(SRC_DIR)/Framework/Resources/Growl-WithInstaller.framework-Info CFBundleVersion '$(VERSION)'
    70 	defaults write $(SRC_DIR)/Framework/Resources/Growl.framework-Info CFBundleVersion '$(VERSION)'
    71 	defaults write $(SRC_DIR)/Core/Resources/Info CFBundleVersion '$(VERSION)'
    72 	defaults write $(SRC_DIR)/Extras/GrowlCode/Info CFBundleVersion '$(VERSION)'
    73 	defaults write $(SRC_DIR)/Extras/GrowlMail/Info CFBundleVersion '$(VERSION)'
    74 	defaults write $(SRC_DIR)/Extras/GrowlSafari/Info CFBundleVersion '$(VERSION)'
    75 	defaults write $(SRC_DIR)/Extras/GrowlTunes/Info CFBundleVersion '$(VERSION)'
    76 	defaults write $(SRC_DIR)/Extras/HardwareGrowler/Info CFBundleVersion '$(VERSION)'
    77 	defaults write $(SRC_DIR)/StatusItem/Resources/MenuExtra-Info CFBundleVersion '$(VERSION)'
    78 
    79 	@# update the CFBundleShortVersionString
    80 	defaults write $(SRC_DIR)/Core/Resources/GrowlHelperApp-Info CFBundleShortVersionString '$(VERSION)'
    81 	defaults write $(SRC_DIR)/Framework/Resources/Growl-WithInstaller.framework-Info CFBundleShortVersionString '$(VERSION)'
    82 	defaults write $(SRC_DIR)/Framework/Resources/Growl.framework-Info CFBundleShortVersionString '$(VERSION)'
    83 	defaults write $(SRC_DIR)/Core/Resources/Info CFBundleShortVersionString '$(VERSION)'
    84 	defaults write $(SRC_DIR)/Extras/GrowlCode/Info CFBundleShortVersionString '$(VERSION)'
    85 	defaults write $(SRC_DIR)/Extras/GrowlMail/Info CFBundleShortVersionString '$(VERSION)'
    86 	defaults write $(SRC_DIR)/Extras/GrowlSafari/Info CFBundleShortVersionString '$(VERSION)'
    87 	defaults write $(SRC_DIR)/Extras/GrowlTunes/Info CFBundleShortVersionString '$(VERSION)'
    88 	defaults write $(SRC_DIR)/Extras/HardwareGrowler/Info CFBundleShortVersionString '$(VERSION)'
    89 	defaults write $(SRC_DIR)/StatusItem/Resources/MenuExtra-Info CFBundleShortVersionString '$(VERSION)'
    90 
    91 	@# Convert back to XML plist, since defaults creates binary plists
    92 	plutil -convert xml1 $(SRC_DIR)/Core/Resources/GrowlHelperApp-Info.plist
    93 	plutil -convert xml1 $(SRC_DIR)/Framework/Resources/Growl-WithInstaller.framework-Info.plist
    94 	plutil -convert xml1 $(SRC_DIR)/Framework/Resources/Growl.framework-Info.plist 
    95 	plutil -convert xml1 $(SRC_DIR)/Core/Resources/Info.plist
    96 	plutil -convert xml1 $(SRC_DIR)/Extras/GrowlCode/Info.plist
    97 	plutil -convert xml1 $(SRC_DIR)/Extras/GrowlMail/Info.plist
    98 	plutil -convert xml1 $(SRC_DIR)/Extras/GrowlSafari/Info.plist
    99 	plutil -convert xml1 $(SRC_DIR)/Extras/GrowlTunes/Info.plist
   100 	plutil -convert xml1 $(SRC_DIR)/Extras/HardwareGrowler/Info.plist
   101 	plutil -convert xml1 $(SRC_DIR)/StatusItem/Resources/MenuExtra-Info.plist
   102 
   103 compile:
   104 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)
   105 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)/Extras/GrowlMail
   106 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)/Extras/GrowlSafari
   107 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)/Extras/growlnotify
   108 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)/Extras/HardwareGrowler
   109 	$(MAKE) $(BUILDFLAGS) -C $(SRC_DIR)/Extras/GrowlTunes
   110 
   111 clean:
   112 	rm -rf $(BUILD_DIR)
   113 
   114 realclean: clean
   115 	../build.sh clean
   116 
   117 release:
   118 	@# clean build directory
   119 	rm -rf $(BUILD_DIR)
   120 	mkdir $(BUILD_DIR)
   121 	mkdir $(GROWL_DIR)
   122 	
   123 	@# Archive dSYM bundles.
   124 	mkdir $(DSYM_DIR)
   125 	mv $(GROWL_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   126 	mv $(GROWLNOTIFY_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   127 	mv $(GROWLTUNES_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   128 	mv $(HARDWAREGROWLER_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   129 	mv $(GROWLMAIL_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   130 	mv $(GROWLSAFARI_BUILD_DIR)/*.dSYM $(DSYM_DIR)
   131 	@# Note: -C only applies to the input names, not -f, so it is correct to use notdir on the directory name and leave it off of the tarball name.
   132 	tar -C $(dir $(DSYM_DIR)) -cjf $(DSYM_DIR).tbz $(notdir $(DSYM_DIR))
   133 	
   134 	@# copy uninstaller
   135 	cp -R "Uninstall Growl.app" $(GROWL_DIR)
   136 	/Developer/Tools/SetFile -a E $(GROWL_DIR)/Uninstall\ Growl.app
   137 	
   138 	@# copy webloc files
   139 	cp "Growl Documentation.webloc" "Growl version history.webloc" "Get more styles.webloc" $(GROWL_DIR)
   140 	
   141 	@# hide extensions of webloc files
   142 	/Developer/Tools/SetFile -a E $(GROWL_DIR)/*.webloc
   143 	
   144 	@# build the prefpane package
   145 	$(PACKAGE_MAKER) --doc Growl/Growl\ Installer.pmdoc --out $(GROWL_DIR)/Growl.mpkg --version $(VERSION) --id com.growl.growl.mpkg -v
   146 	
   147 	@# copy the extras
   148 	mkdir $(GROWL_DIR)/Extras
   149 	mkdir $(GROWL_DIR)/Extras/growlnotify
   150 	cp $(GROWLNOTIFY_BUILD_DIR)/growlnotify $(GROWL_DIR)/Extras/growlnotify
   151 	cp $(SRC_DIR)/Extras/growlnotify/growlnotify.1 $(GROWL_DIR)/Extras/growlnotify
   152 	cp $(SRC_DIR)/Extras/growlnotify/install.sh $(GROWL_DIR)/Extras/growlnotify
   153 	cp $(SRC_DIR)/Extras/growlnotify/*.txt $(GROWL_DIR)/Extras/growlnotify
   154 	mkdir $(GROWL_DIR)/Extras/GrowlTunes
   155 	cp -R $(GROWLTUNES_BUILD_DIR)/GrowlTunes.app $(GROWL_DIR)/Extras/GrowlTunes
   156 	cp -R $(SRC_DIR)/Extras/GrowlTunes/*.rtfd $(GROWL_DIR)/Extras/GrowlTunes
   157 	mkdir $(GROWL_DIR)/Extras/HardwareGrowler
   158 	cp -R $(HARDWAREGROWLER_BUILD_DIR)/HardwareGrowler.app $(GROWL_DIR)/Extras/HardwareGrowler
   159 	cp $(SRC_DIR)/Extras/HardwareGrowler/*.txt $(GROWL_DIR)/Extras/HardwareGrowler
   160 	
   161 	@# build GrowlMail package
   162 	mkdir $(GROWL_DIR)/Extras/GrowlMail
   163 	$(PACKAGE_MAKER) --doc GrowlMail/GrowlMail\ Installer.pmdoc --out $(GROWL_DIR)/Extras/GrowlMail/GrowlMail.mpkg --version $(VERSION) --id com.growl.growlmail.mpkg -v	
   164 	cp $(SRC_DIR)/Extras/GrowlMail/*.rtf $(GROWL_DIR)/Extras/GrowlMail
   165 	
   166 	@# build GrowlSafari package
   167 	mkdir $(GROWL_DIR)/Extras/GrowlSafari
   168 	@# Set its ownership to root:admin and permissions to rwxr-xr-x so that Mac OS X 10.5.3 will load it.
   169 	chmod -R go-w $(GROWLSAFARI_BUILD_DIR)/GrowlSafari
   170 	@echo
   171 	@echo '*** IMPORTANT: If you want to build Growl as a regular (non-admin) user, hit CTRL-D here without entering a password. (Ctrl-C will stop the build.) Note that the GrowlSafari on the disk image will not be usable on Leopard and later if you do this.'
   172 	-(sudo chown -R root:admin $(GROWLSAFARI_BUILD_DIR)/GrowlSafari) || echo "WARNING: GrowlSafari will not work on Leopard and later from this disk image" > /dev/stderr
   173 	$(PACKAGE_MAKER) --doc GrowlSafari/GrowlSafari\ Installer.pmdoc --out $(GROWL_DIR)/Extras/GrowlSafari/GrowlSafari.pkg --version $(VERSION) --id com.growl.growlsafari.pkg -v	
   174 	@# PackageMaker fails at obeying the permissions that we've set forth in the document. Specifically, it sets g+w on everything, in both the BOM and the archive, in direct contravention of what the document says (go-w).
   175 	@# Our workaround, then, is to create the BOM and archive ourselves, replacing the full-of-fail ones that PackageMaker creates.
   176 	mkbom $(GROWLSAFARI_BUILD_DIR)/GrowlSafari $(GROWL_DIR)/Extras/GrowlSafari/GrowlSafari.pkg/Contents/Archive.bom
   177 	(cd $(GROWLSAFARI_BUILD_DIR)/GrowlSafari && pax -w -x cpio -z .) > $(GROWL_DIR)/Extras/GrowlSafari/GrowlSafari.pkg/Contents/Archive.pax.gz
   178 	
   179 	@# build the SDK
   180 	mkdir $(SDK_DIR)
   181 	
   182 	@# copy the webloc files
   183 	cp "Growl Developer Documentation.webloc" "Growl version history for developers.webloc" $(SDK_DIR)
   184 	
   185 	@# hide extensions of webloc files
   186 	/Developer/Tools/SetFile -a E $(SDK_DIR)/*.webloc
   187 	
   188 	@# copy the scripts
   189 	#cp -R $(SRC_DIR)/Scripts $(GROWL_DIR)
   190 	
   191 	@# copy over relevant files to compile directly into app
   192 	mkdir $(SDK_DIR)/Built-In
   193 	cp $(SRC_DIR)/Framework/Source/GrowlApplicationBridge.h $(SDK_DIR)/Built-In
   194 	cp $(SRC_DIR)/Framework/Source/GrowlApplicationBridge.m $(SDK_DIR)/Built-In
   195 	cp $(SRC_DIR)/Common/Source/GrowlDefines.h $(SDK_DIR)/Built-In
   196 	cp $(SRC_DIR)/Common/Source/GrowlDefinesInternal.h $(SDK_DIR)/Built-In
   197 	cp $(SRC_DIR)/Common/Source/GrowlPathUtilities.h $(SDK_DIR)/Built-In
   198 	cp $(SRC_DIR)/Common/Source/GrowlPathUtilities.m $(SDK_DIR)/Built-In 
   199 	cp $(SRC_DIR)/Common/Source/CFGrowlAdditions.h $(SDK_DIR)/Built-In
   200 	cp $(SRC_DIR)/Common/Source/CFGrowlAdditions.c $(SDK_DIR)/Built-In
   201 	cp $(SRC_DIR)/Common/Source/CFGrowlDefines.h $(SDK_DIR)/Built-In
   202 	cp $(SRC_DIR)/Common/Source/CFURLAdditions.h $(SDK_DIR)/Built-In
   203 	cp $(SRC_DIR)/Common/Source/CFURLAdditions.c $(SDK_DIR)/Built-In
   204 	cp $(SRC_DIR)/Common/Source/CFMutableDictionaryAdditions.h $(SDK_DIR)/Built-In
   205 	cp $(SRC_DIR)/Common/Source/CFMutableDictionaryAdditions.c $(SDK_DIR)/Built-In
   206 	cp $(SRC_DIR)/Core/Source/GrowlPreferencesController.h $(SDK_DIR)/Built-In
   207 	cp $(SRC_DIR)/Core/Source/GrowlTicketController.h $(SDK_DIR)/Built-In
   208 	
   209 	@# copy the frameworks
   210 	mkdir $(SDK_DIR)/Frameworks
   211 	cp -R $(GROWL_BUILD_DIR)/Growl.framework $(GROWL_BUILD_DIR)/Growl-WithInstaller.framework $(SDK_DIR)/Frameworks
   212 	
   213 	@# copy the bindings
   214 	cp -R $(SRC_DIR)/Bindings $(SDK_DIR)
   215 	@# remove the AppleScript binding
   216 	rm -rf $(SDK_DIR)/Bindings/applescript
   217 	
   218 	@# remove some symlinks
   219 	rm $(SDK_DIR)/Bindings/tcl/GrowlDefines.h
   220 	rm $(SDK_DIR)/Bindings/tcl/GrowlApplicationBridge.h
   221 	rm $(SDK_DIR)/Bindings/tcl/GrowlApplicationBridge.m
   222 	
   223 	@# delete svn and backup files
   224 	find $(BUILD_DIR) -name ".svn" -type d -exec rm -rf {} \; -prune
   225 	find $(BUILD_DIR) \( -name "*~" -or -name .DS_Store \) -type f -delete
   226 
   227 	@# make Growl disk image
   228 	mkdir $(GROWL_DIR)/.background
   229 	cp $(SRC_DIR)/images/dmg/growlDMGBackground.png $(GROWL_DIR)/.background
   230 	./ensureCustomIconsExtracted $(ART_DIR)
   231 	./make-diskimage.sh $(BUILD_DIR)/$(RELEASE_FILENAME).dmg $(GROWL_DIR) $(RELEASE_NAME) dmg_growl.applescript $(ART_DIR)
   232 	
   233 	@# make SDK disk image
   234 	mkdir $(SDK_DIR)/.background
   235 	cp $(SRC_DIR)/images/dmg/growlSDK.png $(SDK_DIR)/.background
   236 	./make-diskimage.sh $(BUILD_DIR)/$(RELEASE_FILENAME)-SDK.dmg $(SDK_DIR) $(RELEASE_SDK_NAME) dmg_sdk.applescript
   237 	
   238 	@echo Build finished
   239 	-growlnotify -n 'Growl Release Makefile' 'Growl disk image built successfully' -m $(RELEASE_FILENAME).dmg --iconpath $(BUILD_DIR)/$(RELEASE_FILENAME).dmg