root/trunk/uploadr/Makefile

Revision 361, 11.7 kB (checked in by calh, 2 years ago)

no need for LANG_NAME in the makefile any more - that's now defined in the NSIS strings file. added vcredist to SVN - copy it to build tree during installer build.

Line 
1 #
2 # Flickr Uploadr
3 #
4 # Copyright (c) 2007-2008 Yahoo! Inc.  All rights reserved.  This library is
5 # free software; you can redistribute it and/or modify it under the terms of
6 # the GNU General Public License (GPL), version 2 only.  This library is
7 # distributed WITHOUT ANY WARRANTY, whether express or implied. See the GNU
8 # GPL for more details (http://www.gnu.org/licenses/gpl.html)
9 #
10
11 # Macs can build DMGs and MARs for all languages with `make`
12 # Windows can build installers and MARs for all languages with `make win`
13
14 INTL := $(filter de-de en-US es-us fr-fr it-it ko-kr pt-br zh-hk ja-jp, $(MAKECMDGOALS))
15
16 ifeq (de-de, $(INTL))
17 INTL_SHORT := de
18 endif
19 ifeq (en-US, $(INTL))
20 INTL_SHORT := en
21 endif
22 ifeq (es-us, $(INTL))
23 INTL_SHORT := es
24 endif
25 ifeq (fr-fr, $(INTL))
26 INTL_SHORT := fr
27 endif
28 ifeq (it-it, $(INTL))
29 INTL_SHORT := it
30 endif
31 ifeq (ko-kr, $(INTL))
32 INTL_SHORT := kr
33 endif
34 ifeq (pt-br, $(INTL))
35 INTL_SHORT := br
36 endif
37 ifeq (zh-hk, $(INTL))
38 INTL_SHORT := hk
39 endif
40 ifeq (ja-jp, $(INTL))
41 INTL_SHORT := ja
42 endif
43
44
45 ########################################################################
46 ########################################################################
47 # Configuration
48
49 # Source files
50 #   Even though this isn't a very Windows-y path, it makes life
51 #   simpler to use it on all platforms
52 SRC := MacUploadr.app/Contents
53
54 # Version number for Uploadr - this comes from application.ini
55 VER := `grep ^Version= $(SRC)/Resources/application.ini | sed 's/Version=\(.*\)/\1/'`
56
57 ########################################################################
58 # Windows configuration
59
60 ifeq (win, $(filter win, $(MAKECMDGOALS)))
61 PLATFORM := win
62
63 # Location of Mozilla tree for the MAR tools
64 MOZILLA := /c/mozilla
65
66 # Location for application bundle staging
67 APPNAME := Flickr\ Uploadr
68
69 # Location to output finished NSIS installers
70 OUT := /c/code/uploadr
71
72 # Location of the makensis.exe binary
73 MAKE_NSIS := /c/Program\ Files/NSIS/Unicode/makensis.exe
74
75
76 # below here, don't modify anything
77
78 # Dated version for the NSIS installer - this comes from application.ini
79 VER_DATE := `grep ^BuildID= $(SRC)/Resources/application.ini | sed 's/BuildID=\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1.\2.\3.\4/'`
80
81 # Location for build staging
82 BUILD := $(OUT)/builds/$(INTL)
83
84 # Location for application bundle staging
85 APP := $(BUILD)/$(APPNAME)
86
87 # Location for resource file (chrome, components, etc) staging
88 RES := $(APP)
89
90 # End Windows configuration
91 ########################################################################
92
93 ########################################################################
94 # Mac configuration
95
96 else
97 PLATFORM := mac
98
99 # GraphicsMagick version for stupid directory structure
100 GM_VER := 1.1.10
101
102 # Location of Mozilla tree for the MAR tools
103 MOZILLA := ~/mozilla
104
105 # Location for build staging
106 #   The base of this path must exist before running make
107 BUILD := ~/Desktop/builds/$(INTL)
108
109 # Location for application bundle staging
110 APP := $(BUILD)/Flickr\ Uploadr.app
111
112 # Location for resource file (chrome, components, etc) staging
113 RES := $(APP)/Contents/Resources
114
115 # Location to output finished DMGs
116 OUT := ~/Desktop
117
118 # End Mac configuration
119 ########################################################################
120
121 endif
122
123 # End configuration
124 ########################################################################
125 ########################################################################
126
127
128
129 dummy:
130         @echo "Nothing happens if you don't give some arguments!"
131         @echo "  win all, mac all:   Build the whole thing"
132         @echo "  build, mar: Build a single package or update but requires"
133         @echo "              de-de, en-US, es-us, fr-fr, it-it, ko-kr, pt-br, or zh-hk"
134
135 all: all-build all-mar
136
137 mac:
138         @echo "Building for Mac"
139 win:
140         @echo "Building for Windows"
141
142 all-build:
143         make $(PLATFORM) de-de build
144         make $(PLATFORM) en-US build
145         make $(PLATFORM) es-us build
146         make $(PLATFORM) fr-fr build
147         make $(PLATFORM) it-it build
148         make $(PLATFORM) ko-kr build
149         make $(PLATFORM) pt-br build
150         make $(PLATFORM) zh-hk build
151
152 all-mar:
153         @make $(PLATFORM) de-de mar
154         @make $(PLATFORM) en-US mar
155         @make $(PLATFORM) es-us mar
156         @make $(PLATFORM) fr-fr mar
157         @make $(PLATFORM) it-it mar
158         @make $(PLATFORM) ko-kr mar
159         @make $(PLATFORM) pt-br mar
160         @make $(PLATFORM) zh-hk mar
161
162
163
164 de-de:
165         @echo "Building German (de-de)"
166 en-US:
167         @echo "Building English (en-US)"
168 es-us:
169         @echo "Building Spanish (es-us)"
170 fr-fr:
171         @echo "Building French (fr-fr)"
172 it-it:
173         @echo "Building Italian (it-it)"
174 ko-kr:
175         @echo "Building Korean (ko-kr)"
176 pt-br:
177         @echo "Building Portuguese (pt-br)"
178 zh-hk:
179         @echo "Building Chinese (zh-hk)"
180
181
182
183 build:
184
185         @# Make sure the package directory exists
186         mkdir -p $(BUILD)
187
188         @# Saving the previous version for the partial MAR
189 #       rm -rf $(BUILD)/old
190 #       mv $(APP) $(BUILD)/old
191         rm -rf $(APP)
192 ifeq (mac, $(PLATFORM))
193         rm -f $(BUILD)/Applications
194 endif
195
196         @# Package structure
197 ifeq (mac, $(PLATFORM))
198         mkdir -p $(APP)/Contents
199         mkdir $(APP)/Contents/lib
200         mkdir $(APP)/Contents/Frameworks
201         mkdir $(APP)/Contents/MacOS
202         mkdir $(RES)
203         cp $(SRC)/Info.plist $(APP)/Contents/
204 else
205         mkdir $(APP)
206 endif
207
208         @# GraphicsMagick config files
209 ifeq (mac, $(PLATFORM))
210         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)
211         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config
212         cp $(SRC)/lib/GraphicsMagick-$(GM_VER)/config/*.mgk \
213                 $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config/
214 else
215         cp $(SRC)/Resources/*.mgk $(RES)/
216 endif
217
218         @# XULRunner
219         cp $(SRC)/Resources/application.ini $(RES)/
220         cp $(SRC)/Resources/LICENSE.txt $(RES)/
221 ifeq (mac, $(PLATFORM))
222         cp -R $(SRC)/Frameworks/XUL.framework $(APP)/Contents/Frameworks/
223         cp $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/xulrunner \
224                 $(APP)/Contents/MacOS/xulrunner
225         cp $(SRC)/Resources/icons.icns $(RES)/
226 endif
227 ifeq (win, $(PLATFORM))
228         cp -R $(SRC)/Resources/xulrunner $(RES)/
229         cp $(SRC)/Resources/Flickr\ Uploadr.exe $(RES)/
230         cp $(SRC)/Resources/libexpat.dll $(RES)/
231         cp $(SRC)/Resources/icons.ico $(RES)/
232 endif
233
234         @# XULRunner preferences
235         mkdir -p $(RES)/defaults/preferences
236         cp $(SRC)/Resources/defaults/preferences/*.js \
237                 $(RES)/defaults/preferences/
238         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/defaults/preferences/prefs.js > \
239                 $(RES)/defaults/preferences/prefs.js
240
241         @# XULRunner locale
242 ifeq (mac, $(PLATFORM))
243         rm $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/??-??.*
244         cp ./xulrunner_locales/$(INTL).* \
245                 $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/
246 else
247         rm $(RES)/xulrunner/chrome/??-??.*
248         cp ./xulrunner_locales/$(INTL).* $(RES)/xulrunner/chrome/
249 endif
250
251         @# Chrome
252         mkdir $(RES)/chrome
253         mkdir $(BUILD)/jar
254         mkdir $(BUILD)/jar/content
255         mkdir $(BUILD)/jar/content/uploadr
256         cp $(SRC)/Resources/chrome/content/uploadr/*.* $(BUILD)/jar/content/uploadr/
257         mkdir $(BUILD)/jar/content/hacks
258 ifeq (mac, $(PLATFORM))
259         mkdir $(BUILD)/jar/content/hacks/mac
260         cp $(SRC)/Resources/chrome/content/hacks/mac/*.xul $(BUILD)/jar/content/hacks/mac/
261 #       cp $(SRC)/Resources/chrome/content/hacks/mac/*.js $(BUILD)/jar/content/hacks/mac/
262 endif
263 ifeq (win, $(PLATFORM))
264         mkdir $(BUILD)/jar/content/hacks/win
265         cp $(SRC)/Resources/chrome/content/hacks/win/*.xul $(BUILD)/jar/content/hacks/win/
266 #       cp $(SRC)/Resources/chrome/content/hacks/win/*.js $(BUILD)/jar/content/hacks/win/
267 endif
268 ifeq (linux, $(PLATFORM))
269         mkdir content/hacks/unix
270         cp $(SRC)/Resources/chrome/content/hacks/unix/*.xul $(BUILD)/jar/content/hacks/unix/
271 #       cp $(SRC)/Resources/chrome/content/hacks/unix/*.js $(BUILD)/jar/content/hacks/unix/
272 endif
273         mkdir $(BUILD)/jar/locale
274         mkdir $(BUILD)/jar/locale/branding
275         cp $(SRC)/Resources/chrome/locale/branding/*.* $(BUILD)/jar/locale/branding/
276         mkdir $(BUILD)/jar/locale/$(INTL)
277         cp $(SRC)/Resources/chrome/locale/$(INTL)/*.* $(BUILD)/jar/locale/$(INTL)/
278         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/chrome/chrome.manifest.prod > \
279                 $(RES)/chrome/chrome.manifest
280         mkdir $(BUILD)/jar/skin
281 #ifeq (mac, $(PLATFORM))
282 #       mkdir $(BUILD)/jar/skin/hacks
283 #       mkdir $(BUILD)/jar/skin/hacks/mac
284 #       cp $(SRC)/Resources/chrome/skin/hacks/mac/hacks.css $(BUILD)/jar/skin/hacks/mac/
285 #endif
286 #ifeq (win, $(PLATFORM))
287 #       mkdir $(BUILD)/jar/skin/hacks/win
288 #       cp $(SRC)/Resources/chrome/skin/hacks/win/hacks.css $(BUILD)/jar/skin/hacks/win/
289 #endif
290 #ifeq (linux, $(PLATFORM))
291 #       mkdir $(BUILD)/jar/skin/hacks/unix
292 #       cp $(SRC)/Resources/chrome/skin/hacks/unix/hacks.css $(BUILD)/jar/skin/hacks/unix/
293 #endif
294         mkdir $(BUILD)/jar/skin/uploadr
295         cp $(SRC)/Resources/chrome/skin/uploadr/*.css $(BUILD)/jar/skin/uploadr/
296         cp $(SRC)/Resources/chrome/skin/uploadr/*.gif $(BUILD)/jar/skin/uploadr/
297         cp $(SRC)/Resources/chrome/skin/uploadr/*.png $(BUILD)/jar/skin/uploadr/
298 ifeq (win, $(PLATFORM))
299         cd $(BUILD)/jar/ && zip uploadr.zip -r content locale skin
300 else
301         cd $(BUILD)/jar/ && zip uploadr -r content locale skin
302 endif
303         mv $(BUILD)/jar/uploadr.zip $(RES)/chrome/uploadr.jar
304         rm -rf $(BUILD)/jar
305
306         @# Non-JAR'd Chrome
307         mkdir $(RES)/chrome/icons
308         mkdir $(RES)/chrome/icons/default
309         cp $(SRC)/Resources/chrome/icons/default/*.ico $(RES)/chrome/icons/default/
310
311         @# XPCOM
312         mkdir $(RES)/components
313         cp $(SRC)/Resources/components/*.xpt $(RES)/components/
314 ifeq (mac, $(PLATFORM))
315         cp $(SRC)/Resources/components/*.dylib $(RES)/components/
316 endif
317 ifeq (win, $(PLATFORM))
318         cp $(SRC)/Resources/components/*.dll $(RES)/components/
319 endif
320 ifeq (linux, $(PLATFORM))
321         cp $(SRC)/Resources/components/*.so $(RES)/components/
322 endif
323         cp $(SRC)/Resources/components/*.js $(RES)/components/
324
325         @# Create DMG for Macs
326 ifeq (mac, $(PLATFORM))
327         ln -s /Applications $(BUILD)/Applications
328         cp mac_installer/install-pane-$(INTL_SHORT).png $(BUILD)/.i.png
329         cp mac_installer/DS_Store $(BUILD)/.DS_Store
330         rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
331         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
332                 -format UDZO -imagekey zlib-level=9 \
333                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
334 endif
335
336         @# Create NSIS installer for Windows
337 ifeq (win, $(PLATFORM))
338
339         perl -e 'print chr(255).chr(254)' > \
340                 $(BUILD)/build.nsi
341         perl -pe 's/(.)/$$1\0/sg' win_installer/build.nsi >> \
342                 $(BUILD)/build.nsi
343
344         cp win_installer/strings-$(INTL).nsh $(BUILD)/strings.nsh
345         cp win_installer/config-$(INTL).ini $(BUILD)/config.ini
346         cp win_installer/vcredist_x86.exe $(BUILD)/vcredist_x86.exe
347
348         $(MAKE_NSIS) -DVERSION=$(VER) \
349                 -DVERSION_DATE=$(VER_DATE) \
350                 $(BUILD)/build.nsi
351
352         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
353                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).exe
354
355         rm $(BUILD)/build.nsi
356         rm $(BUILD)/strings.nsh
357         rm $(BUILD)/config.ini
358         rm $(BUILD)/vcredist_x86.exe
359 endif
360
361         @# Create ??? for Linux
362 ifeq (linux, $(PLATFORM))
363 endif
364
365
366
367 mar:
368
369         @# Making MAR files
370 ifeq (mac, $(PLATFORM))
371         @ln -s Flickr\ Uploadr.app $(BUILD)/new
372 endif
373 ifeq (win, $(PLATFORM))
374         @# In Windows, `ln -s ...` == `cp -R ...`
375         @ln -s $(BUILD)/Flickr\ Uploadr $(BUILD)/new
376 endif
377 ifeq (linux, $(PLATFORM))
378         @ln -s Flickr\ Uploadr $(BUILD)/new
379 endif
380         @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar
381         @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
382                 $(MOZILLA)/tools/update-packaging/make_full_update.sh \
383                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar \
384                 $(BUILD)/new &> /dev/null
385 #       @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar
386 #       @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
387 #               $(MOZILLA)/tools/update-packaging/make_incremental_update.sh \
388 #               $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar \
389 #               $(BUILD)/old $(BUILD)/new &> /dev/null
390 ifeq (win, $(PLATFORM))
391         @rm -rf $(BUILD)/new
392 else
393         @rm $(BUILD)/new
394 endif
395
396         @# Size and hash for the XML file
397 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
398 #               awk '{print "$(INTL) complete size: ",$$5}'
399 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
400 #               awk '{print "$(INTL) complete MD5:  ",$$4}'
401 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
402 #               awk '{print "$(INTL) partial size: ",$$5}'
403 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
404 #               awk '{print "$(INTL) partial MD5:  ",$$4}'
Note: See TracBrowser for help on using the browser.