root/trunk/uploadr/Makefile

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

=accomodate new location of mar tool

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