root/trunk/uploadr/Makefile

Revision 506, 13.6 kB (checked in by jdecq, 10 months ago)

add the vcredist in the update package

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.2.5
101
102 # Location of Mozilla tree for the MAR tools
103 MOZILLA := ~/UPLOADR/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 "  packaging, 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         @echo "              dev for development build: i.e. unjared content"
135
136 all: all-build all-mar
137
138 mac:
139         @echo "Building for Mac"
140 win:
141         @echo "Building for Windows"
142
143 all-build:
144         make $(PLATFORM) de-de packaging
145         make $(PLATFORM) en-US packaging
146         make $(PLATFORM) es-us packaging
147         make $(PLATFORM) fr-fr packaging
148         make $(PLATFORM) it-it packaging
149         make $(PLATFORM) ko-kr packaging
150         make $(PLATFORM) pt-br packaging
151         make $(PLATFORM) zh-hk packaging
152         make $(PLATFORM) ja-jp packaging
153
154 all-mar:
155         @make $(PLATFORM) de-de mar
156         @make $(PLATFORM) en-US mar
157         @make $(PLATFORM) es-us mar
158         @make $(PLATFORM) fr-fr mar
159         @make $(PLATFORM) it-it mar
160         @make $(PLATFORM) ko-kr mar
161         @make $(PLATFORM) pt-br mar
162         @make $(PLATFORM) zh-hk mar
163         @make $(PLATFORM) ja-jp mar
164
165
166 de-de:
167         @echo "Building German (de-de)"
168 en-US:
169         @echo "Building English (en-US)"
170 es-us:
171         @echo "Building Spanish (es-us)"
172 fr-fr:
173         @echo "Building French (fr-fr)"
174 it-it:
175         @echo "Building Italian (it-it)"
176 ko-kr:
177         @echo "Building Korean (ko-kr)"
178 pt-br:
179         @echo "Building Portuguese (pt-br)"
180 zh-hk:
181         @echo "Building Chinese (zh-hk)"
182 ja-jp:
183         @echo "Building Japanese (ja-jp)"
184 dev:
185         @echo "Development Build"
186
187 packaging:
188         @echo "Build step"
189         @# Make sure the package directory exists
190         mkdir -p $(BUILD)
191
192         @# Saving the previous version for the partial MAR
193 #       rm -rf $(BUILD)/old
194 #       mv $(APP) $(BUILD)/old
195         rm -rf $(APP)
196 ifeq (mac, $(PLATFORM))
197         rm -f $(BUILD)/Applications
198 endif
199
200         @# Package structure
201 ifeq (mac, $(PLATFORM))
202         mkdir -p $(APP)/Contents
203         mkdir $(APP)/Contents/lib
204         mkdir $(APP)/Contents/Frameworks
205         mkdir $(APP)/Contents/MacOS
206         mkdir $(RES)
207         cp $(SRC)/Info.plist $(APP)/Contents/
208 else
209         mkdir $(APP)
210 endif
211
212         @# GraphicsMagick config files
213 ifeq (mac, $(PLATFORM))
214         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)
215         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config
216         cp $(SRC)/lib/GraphicsMagick-$(GM_VER)/config/*.mgk \
217                 $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config/
218 else
219         cp $(SRC)/Resources/*.mgk $(RES)/
220 endif
221
222         @# XULRunner
223         cp $(SRC)/Resources/application.ini $(RES)/
224         cp $(SRC)/Resources/LICENSE.txt $(RES)/
225 ifeq (mac, $(PLATFORM))
226         cp -R $(SRC)/Frameworks/XUL.framework $(APP)/Contents/Frameworks/
227         cp $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/xulrunner \
228                 $(APP)/Contents/MacOS/xulrunner
229         cp $(SRC)/Resources/icons.icns $(RES)/
230 endif
231 ifeq (win, $(PLATFORM))
232         cp -R $(SRC)/Resources/xulrunner $(RES)/
233         cp $(SRC)/Resources/Flickr\ Uploadr.exe $(RES)/
234         cp $(SRC)/Resources/libexpat.dll $(RES)/
235         cp $(SRC)/Resources/icons.ico $(RES)/
236 endif
237
238         @# XULRunner preferences
239         mkdir -p $(RES)/defaults/preferences
240         cp $(SRC)/Resources/defaults/preferences/*.js \
241                 $(RES)/defaults/preferences/
242         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/defaults/preferences/prefs.js > \
243                 $(RES)/defaults/preferences/prefs.js
244
245         @# XULRunner locale
246 ifeq (mac, $(PLATFORM))
247         rm $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/??-??.*
248         cp ./xulrunner_locales/$(INTL).* \
249                 $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/
250 else
251         rm $(RES)/xulrunner/chrome/??-??.*
252         cp ./xulrunner_locales/$(INTL).* $(RES)/xulrunner/chrome/
253 endif
254
255         @# Chrome
256         mkdir $(RES)/chrome
257         mkdir $(BUILD)/jar
258         mkdir $(BUILD)/jar/content
259         mkdir $(BUILD)/jar/content/uploadr
260         cp $(SRC)/Resources/chrome/content/uploadr/*.js $(BUILD)/jar/content/uploadr/
261         cp $(SRC)/Resources/chrome/content/uploadr/*.xul $(BUILD)/jar/content/uploadr/
262         mkdir $(BUILD)/jar/content/hacks
263 ifeq (mac, $(PLATFORM))
264         mkdir $(BUILD)/jar/content/hacks/mac
265         cp $(SRC)/Resources/chrome/content/hacks/mac/*.xul $(BUILD)/jar/content/hacks/mac/
266 #       cp $(SRC)/Resources/chrome/content/hacks/mac/*.js $(BUILD)/jar/content/hacks/mac/
267 endif
268 ifeq (win, $(PLATFORM))
269         mkdir $(BUILD)/jar/content/hacks/win
270         cp $(SRC)/Resources/chrome/content/hacks/win/*.xul $(BUILD)/jar/content/hacks/win/
271 #       cp $(SRC)/Resources/chrome/content/hacks/win/*.js $(BUILD)/jar/content/hacks/win/
272 endif
273 ifeq (linux, $(PLATFORM))
274         mkdir content/hacks/unix
275         cp $(SRC)/Resources/chrome/content/hacks/unix/*.xul $(BUILD)/jar/content/hacks/unix/
276 #       cp $(SRC)/Resources/chrome/content/hacks/unix/*.js $(BUILD)/jar/content/hacks/unix/
277 endif
278         mkdir $(BUILD)/jar/locale
279         mkdir $(BUILD)/jar/locale/branding
280         cp $(SRC)/Resources/chrome/locale/branding/*.* $(BUILD)/jar/locale/branding/
281         mkdir $(BUILD)/jar/locale/$(INTL)
282         cp $(SRC)/Resources/chrome/locale/$(INTL)/*.* $(BUILD)/jar/locale/$(INTL)/
283 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
284         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/chrome/chrome.manifest > \
285                 $(RES)/chrome/chrome.manifest
286 else
287         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/chrome/chrome.manifest.prod > \
288                 $(RES)/chrome/chrome.manifest
289 endif
290         mkdir $(BUILD)/jar/skin
291 #ifeq (mac, $(PLATFORM))
292 #       mkdir $(BUILD)/jar/skin/hacks
293 #       mkdir $(BUILD)/jar/skin/hacks/mac
294 #       cp $(SRC)/Resources/chrome/skin/hacks/mac/hacks.css $(BUILD)/jar/skin/hacks/mac/
295 #endif
296 #ifeq (win, $(PLATFORM))
297 #       mkdir $(BUILD)/jar/skin/hacks/win
298 #       cp $(SRC)/Resources/chrome/skin/hacks/win/hacks.css $(BUILD)/jar/skin/hacks/win/
299 #endif
300 #ifeq (linux, $(PLATFORM))
301 #       mkdir $(BUILD)/jar/skin/hacks/unix
302 #       cp $(SRC)/Resources/chrome/skin/hacks/unix/hacks.css $(BUILD)/jar/skin/hacks/unix/
303 #endif
304         mkdir $(BUILD)/jar/skin/uploadr
305         cp $(SRC)/Resources/chrome/skin/uploadr/*.css $(BUILD)/jar/skin/uploadr/
306         cp $(SRC)/Resources/chrome/skin/uploadr/*.gif $(BUILD)/jar/skin/uploadr/
307         cp $(SRC)/Resources/chrome/skin/uploadr/*.png $(BUILD)/jar/skin/uploadr/
308
309 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
310         cd $(BUILD)/jar/ && mv content $(RES)/chrome/ && mv locale $(RES)/chrome/ && mv skin $(RES)/chrome/
311 else
312 ifeq (win, $(PLATFORM))
313         cd $(BUILD)/jar/ && zip uploadr.zip -r content locale skin
314 else
315         cd $(BUILD)/jar/ && zip uploadr -r content locale skin
316 endif
317         mv $(BUILD)/jar/uploadr.zip $(RES)/chrome/uploadr.jar
318 endif
319         rm -rf $(BUILD)/jar
320
321         @# Non-JAR'd Chrome
322         mkdir $(RES)/chrome/icons
323         mkdir $(RES)/chrome/icons/default
324         cp $(SRC)/Resources/chrome/icons/default/*.ico $(RES)/chrome/icons/default/
325
326         @# XPCOM
327         mkdir $(RES)/components
328         cp $(SRC)/Resources/components/*.xpt $(RES)/components/
329 ifeq (mac, $(PLATFORM))
330         cp $(SRC)/Resources/components/*.dylib $(RES)/components/
331 endif
332 ifeq (win, $(PLATFORM))
333         cp $(SRC)/Resources/components/*.dll $(RES)/components/
334 endif
335 ifeq (linux, $(PLATFORM))
336         cp $(SRC)/Resources/components/*.so $(RES)/components/
337 endif
338         cp $(SRC)/Resources/components/*.js $(RES)/components/
339
340         @# Create DMG for Macs
341 ifeq (mac, $(PLATFORM))
342         ln -s /Applications $(BUILD)/Applications
343         cp mac_installer/install-pane-$(INTL_SHORT).png $(BUILD)/.i.png
344         cp mac_installer/DS_Store $(BUILD)/.DS_Store
345         rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
346 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
347         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
348                 -format UDZO -imagekey zlib-level=9 \
349                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT)-dev.dmg
350 else
351         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
352                 -format UDZO -imagekey zlib-level=9 \
353                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
354 endif
355 endif
356
357         @# Create NSIS installer for Windows
358 ifeq (win, $(PLATFORM))
359
360         perl win_installer/strsub.pl win_installer/strings.nsh \
361                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
362                 $(BUILD)/strings-temp.nsh
363         perl win_installer/utf16.pl \
364                 $(BUILD)/strings-temp.nsh > \
365                 $(BUILD)/strings.nsh
366         rm $(BUILD)/strings-temp.nsh
367
368         perl win_installer/strsub.pl win_installer/config.ini \
369                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
370                 $(BUILD)/config-temp.ini
371         perl win_installer/utf16.pl \
372                 $(BUILD)/config-temp.ini > \
373                 $(BUILD)/config.ini
374         rm $(BUILD)/config-temp.ini
375 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
376         perl win_installer/utf16.pl \
377                 win_installer/build_dev.nsi > \
378                 $(BUILD)/build.nsi
379 else
380         perl win_installer/utf16.pl \
381                 win_installer/build.nsi > \
382                 $(BUILD)/build.nsi
383 endif
384         cp win_installer/vcredist_x86.exe $(APP)/vcredist_x86.exe
385
386         $(MAKE_NSIS) -DVERSION=$(VER) \
387                 -DVERSION_DATE=$(VER_DATE) \
388                 $(BUILD)/build.nsi
389 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
390         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
391                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT)-dev.exe
392 else
393         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
394                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).exe
395 endif
396         rm $(BUILD)/build.nsi
397         rm $(BUILD)/strings.nsh
398         rm $(BUILD)/config.ini
399 endif
400
401         @# Create ??? for Linux
402 ifeq (linux, $(PLATFORM))
403 endif
404
405
406
407 mar:
408
409         @echo "MAR step"
410         @# Making MAR files
411 ifeq (mac, $(PLATFORM))
412         @ln -s Flickr\ Uploadr.app $(BUILD)/new
413 endif
414 ifeq (win, $(PLATFORM))
415         @# In Windows, `ln -s ...` == `cp -R ...`
416         @ln -s $(BUILD)/Flickr\ Uploadr $(BUILD)/new
417 endif
418 ifeq (linux, $(PLATFORM))
419         @ln -s Flickr\ Uploadr $(BUILD)/new
420 endif
421         @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar
422         @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
423                 $(MOZILLA)/tools/update-packaging/make_full_update.sh \
424                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT)-$(PLATFORM).complete.mar \
425                 $(BUILD)/new &> /dev/null
426 #       @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar
427 #       @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
428 #               $(MOZILLA)/tools/update-packaging/make_incremental_update.sh \
429 #               $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar \
430 #               $(BUILD)/old $(BUILD)/new &> /dev/null
431 ifeq (win, $(PLATFORM))
432         @rm -rf $(BUILD)/new
433 else
434         @rm $(BUILD)/new
435 endif
436
437         @# Size and hash for the XML file
438 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
439 #               awk '{print "$(INTL) complete size: ",$$5}'
440 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
441 #               awk '{print "$(INTL) complete MD5:  ",$$4}'
442 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
443 #               awk '{print "$(INTL) partial size: ",$$5}'
444 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
445 #               awk '{print "$(INTL) partial MD5:  ",$$4}'
Note: See TracBrowser for help on using the browser.