root/trunk/uploadr/Makefile

Revision 532, 13.9 kB (checked in by jdecq, 9 months ago)

- Version 3.2 of Flickr Uploadr
- Version 1.9.1 pre-release of XULrunner : multi-threading is real now
- One thread per thumbnail (this is probably too much but a start before using a thread pool)

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 # Dated version for the NSIS installer - this comes from application.ini
57 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/'`
58
59 ########################################################################
60 # Windows configuration
61
62 ifeq (win, $(filter win, $(MAKECMDGOALS)))
63 PLATFORM := win
64
65 # Location of Mozilla tree for the MAR tools
66 MOZILLA := /c/mozilla
67
68 # Location for application bundle staging
69 APPNAME := Flickr\ Uploadr
70
71 # Location to output finished NSIS installers
72 OUT := /c/code/uploadr
73
74 # Location of the makensis.exe binary
75 MAKE_NSIS := /c/Program\ Files/NSIS/Unicode/makensis.exe
76
77
78 # below here, don't modify anything
79
80 # Location for build staging
81 BUILD := $(OUT)/builds/$(INTL)
82
83 # Location for application bundle staging
84 APP := $(BUILD)/$(APPNAME)
85
86 # Location for resource file (chrome, components, etc) staging
87 RES := $(APP)
88
89 # End Windows configuration
90 ########################################################################
91
92 ########################################################################
93 # Mac configuration
94
95 else
96 PLATFORM := mac
97
98 # GraphicsMagick version for stupid directory structure
99 GM_VER := 1.2.5
100
101 # Location of Mozilla tree for the MAR tools
102 MOZILLA := ~/UPLOADR/mozilla
103
104 # Location for build staging
105 #   The base of this path must exist before running make
106 BUILD := ~/Desktop/builds/$(INTL)
107
108 # Location for application bundle staging
109 APP := $(BUILD)/Flickr\ Uploadr.app
110
111 # Location for resource file (chrome, components, etc) staging
112 RES := $(APP)/Contents/Resources
113
114 # Location to output finished DMGs
115 OUT := ~/Desktop
116
117 # End Mac configuration
118 ########################################################################
119
120 endif
121
122 # End configuration
123 ########################################################################
124 ########################################################################
125
126
127
128 dummy:
129         @echo "Nothing happens if you don't give some arguments!"
130         @echo "  win all, mac all:   Build the whole thing"
131         @echo "  packaging, mar: Build a single package or update but requires"
132         @echo "              de-de, en-US, es-us, fr-fr, it-it, ko-kr, pt-br, or zh-hk"
133         @echo "              dev for development build: i.e. unjared content"
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 packaging
144         make $(PLATFORM) en-US packaging
145         make $(PLATFORM) es-us packaging
146         make $(PLATFORM) fr-fr packaging
147         make $(PLATFORM) it-it packaging
148         make $(PLATFORM) ko-kr packaging
149         make $(PLATFORM) pt-br packaging
150         make $(PLATFORM) zh-hk packaging
151         make $(PLATFORM) ja-jp packaging
152
153 all-mar:
154         @make $(PLATFORM) de-de mar
155         @make $(PLATFORM) en-US mar
156         @make $(PLATFORM) es-us mar
157         @make $(PLATFORM) fr-fr mar
158         @make $(PLATFORM) it-it mar
159         @make $(PLATFORM) ko-kr mar
160         @make $(PLATFORM) pt-br mar
161         @make $(PLATFORM) zh-hk mar
162         @make $(PLATFORM) ja-jp mar
163
164
165 de-de:
166         @echo "Building German (de-de)"
167 en-US:
168         @echo "Building English (en-US)"
169 es-us:
170         @echo "Building Spanish (es-us)"
171 fr-fr:
172         @echo "Building French (fr-fr)"
173 it-it:
174         @echo "Building Italian (it-it)"
175 ko-kr:
176         @echo "Building Korean (ko-kr)"
177 pt-br:
178         @echo "Building Portuguese (pt-br)"
179 zh-hk:
180         @echo "Building Chinese (zh-hk)"
181 ja-jp:
182         @echo "Building Japanese (ja-jp)"
183 dev:
184         @echo "Development Build"
185
186 packaging:
187         @echo "Build step"
188         @# Make sure the package directory exists
189         mkdir -p $(BUILD)
190
191         @# Saving the previous version for the partial MAR
192 #       rm -rf $(BUILD)/old
193 #       mv $(APP) $(BUILD)/old
194         rm -rf $(APP)
195 ifeq (mac, $(PLATFORM))
196         rm -f $(BUILD)/Applications
197 endif
198
199         @# Package structure
200 ifeq (mac, $(PLATFORM))
201         mkdir -p $(APP)/Contents
202         mkdir $(APP)/Contents/lib
203         mkdir $(APP)/Contents/Frameworks
204         mkdir $(APP)/Contents/MacOS
205         mkdir $(RES)
206         cp $(SRC)/Info.plist $(APP)/Contents/
207 else
208         mkdir $(APP)
209 endif
210
211         @# GraphicsMagick config files
212 ifeq (mac, $(PLATFORM))
213         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)
214         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config
215         cp $(SRC)/lib/GraphicsMagick-$(GM_VER)/config/*.mgk \
216                 $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config/
217 else
218         cp $(SRC)/Resources/*.mgk $(RES)/
219 endif
220
221         @# XULRunner
222         cp $(SRC)/Resources/application.ini $(RES)/
223         cp $(SRC)/Resources/chrome/locale/$(INTL)/updater.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)-$(VER_DATE)-$(INTL_SHORT).dmg
346         rm -f $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT)-dev.dmg
347 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
348         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
349                 -format UDZO -imagekey zlib-level=9 \
350                 $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT)-dev.dmg
351 else
352         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
353                 -format UDZO -imagekey zlib-level=9 \
354                 $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT).dmg
355 endif
356 endif
357
358         @# Create NSIS installer for Windows
359 ifeq (win, $(PLATFORM))
360
361         perl win_installer/strsub.pl win_installer/strings.nsh \
362                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
363                 $(BUILD)/strings-temp.nsh
364         perl win_installer/utf16.pl \
365                 $(BUILD)/strings-temp.nsh > \
366                 $(BUILD)/strings.nsh
367         rm $(BUILD)/strings-temp.nsh
368
369         perl win_installer/strsub.pl win_installer/config.ini \
370                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
371                 $(BUILD)/config-temp.ini
372         perl win_installer/utf16.pl \
373                 $(BUILD)/config-temp.ini > \
374                 $(BUILD)/config.ini
375         rm $(BUILD)/config-temp.ini
376 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
377         perl win_installer/utf16.pl \
378                 win_installer/build_dev.nsi > \
379                 $(BUILD)/build.nsi
380 else
381         perl win_installer/utf16.pl \
382                 win_installer/build.nsi > \
383                 $(BUILD)/build.nsi
384 endif
385         cp win_installer/vcredist_x86.exe $(APP)/vcredist_x86.exe
386
387         $(MAKE_NSIS) -DVERSION=$(VER) \
388                 -DVERSION_DATE=$(VER_DATE) \
389                 $(BUILD)/build.nsi
390 ifeq (dev, $(filter dev, $(MAKECMDGOALS)))
391         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
392                 $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT)-dev.exe
393 else
394         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
395                 $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT).exe
396 endif
397         rm $(BUILD)/build.nsi
398         rm $(BUILD)/strings.nsh
399         rm $(BUILD)/config.ini
400 endif
401
402         @# Create ??? for Linux
403 ifeq (linux, $(PLATFORM))
404 endif
405
406
407
408 mar:
409
410         @echo "MAR step"
411         @# Making MAR files
412 ifeq (mac, $(PLATFORM))
413         @ln -s Flickr\ Uploadr.app $(BUILD)/new
414 endif
415 ifeq (win, $(PLATFORM))
416         @# In Windows, `ln -s ...` == `cp -R ...`
417         @ln -s $(BUILD)/Flickr\ Uploadr $(BUILD)/new
418 endif
419 ifeq (linux, $(PLATFORM))
420         @ln -s Flickr\ Uploadr $(BUILD)/new
421 endif
422         @rm -f $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT).complete.mar
423         @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
424                 $(MOZILLA)/tools/update-packaging/make_full_update.sh \
425                 $(OUT)/FlickrUploadr-$(VER)-$(VER_DATE)-$(INTL_SHORT)-$(PLATFORM).complete.mar \
426                 $(BUILD)/new &> /dev/null
427 #       @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar
428 #       @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
429 #               $(MOZILLA)/tools/update-packaging/make_incremental_update.sh \
430 #               $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar \
431 #               $(BUILD)/old $(BUILD)/new &> /dev/null
432 ifeq (win, $(PLATFORM))
433         @rm -rf $(BUILD)/new
434 else
435         @rm $(BUILD)/new
436 endif
437
438         @# Size and hash for the XML file
439 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
440 #               awk '{print "$(INTL) complete size: ",$$5}'
441 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
442 #               awk '{print "$(INTL) complete MD5:  ",$$4}'
443 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
444 #               awk '{print "$(INTL) partial size: ",$$5}'
445 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
446 #               awk '{print "$(INTL) partial MD5:  ",$$4}'
Note: See TracBrowser for help on using the browser.