root/trunk/uploadr/Makefile

Revision 377, 12.2 kB (checked in by mygrant, 4 months ago)

Fix some typos, update some instructions

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 := ~/devel/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         make $(PLATFORM) ja-jp build
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
184
185
186 build:
187
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/*.* $(BUILD)/jar/content/uploadr/
261         mkdir $(BUILD)/jar/content/hacks
262 ifeq (mac, $(PLATFORM))
263         mkdir $(BUILD)/jar/content/hacks/mac
264         cp $(SRC)/Resources/chrome/content/hacks/mac/*.xul $(BUILD)/jar/content/hacks/mac/
265 #       cp $(SRC)/Resources/chrome/content/hacks/mac/*.js $(BUILD)/jar/content/hacks/mac/
266 endif
267 ifeq (win, $(PLATFORM))
268         mkdir $(BUILD)/jar/content/hacks/win
269         cp $(SRC)/Resources/chrome/content/hacks/win/*.xul $(BUILD)/jar/content/hacks/win/
270 #       cp $(SRC)/Resources/chrome/content/hacks/win/*.js $(BUILD)/jar/content/hacks/win/
271 endif
272 ifeq (linux, $(PLATFORM))
273         mkdir content/hacks/unix
274         cp $(SRC)/Resources/chrome/content/hacks/unix/*.xul $(BUILD)/jar/content/hacks/unix/
275 #       cp $(SRC)/Resources/chrome/content/hacks/unix/*.js $(BUILD)/jar/content/hacks/unix/
276 endif
277         mkdir $(BUILD)/jar/locale
278         mkdir $(BUILD)/jar/locale/branding
279         cp $(SRC)/Resources/chrome/locale/branding/*.* $(BUILD)/jar/locale/branding/
280         mkdir $(BUILD)/jar/locale/$(INTL)
281         cp $(SRC)/Resources/chrome/locale/$(INTL)/*.* $(BUILD)/jar/locale/$(INTL)/
282         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/chrome/chrome.manifest.prod > \
283                 $(RES)/chrome/chrome.manifest
284         mkdir $(BUILD)/jar/skin
285 #ifeq (mac, $(PLATFORM))
286 #       mkdir $(BUILD)/jar/skin/hacks
287 #       mkdir $(BUILD)/jar/skin/hacks/mac
288 #       cp $(SRC)/Resources/chrome/skin/hacks/mac/hacks.css $(BUILD)/jar/skin/hacks/mac/
289 #endif
290 #ifeq (win, $(PLATFORM))
291 #       mkdir $(BUILD)/jar/skin/hacks/win
292 #       cp $(SRC)/Resources/chrome/skin/hacks/win/hacks.css $(BUILD)/jar/skin/hacks/win/
293 #endif
294 #ifeq (linux, $(PLATFORM))
295 #       mkdir $(BUILD)/jar/skin/hacks/unix
296 #       cp $(SRC)/Resources/chrome/skin/hacks/unix/hacks.css $(BUILD)/jar/skin/hacks/unix/
297 #endif
298         mkdir $(BUILD)/jar/skin/uploadr
299         cp $(SRC)/Resources/chrome/skin/uploadr/*.css $(BUILD)/jar/skin/uploadr/
300         cp $(SRC)/Resources/chrome/skin/uploadr/*.gif $(BUILD)/jar/skin/uploadr/
301         cp $(SRC)/Resources/chrome/skin/uploadr/*.png $(BUILD)/jar/skin/uploadr/
302 ifeq (win, $(PLATFORM))
303         cd $(BUILD)/jar/ && zip uploadr.zip -r content locale skin
304 else
305         cd $(BUILD)/jar/ && zip uploadr -r content locale skin
306 endif
307         mv $(BUILD)/jar/uploadr.zip $(RES)/chrome/uploadr.jar
308         rm -rf $(BUILD)/jar
309
310         @# Non-JAR'd Chrome
311         mkdir $(RES)/chrome/icons
312         mkdir $(RES)/chrome/icons/default
313         cp $(SRC)/Resources/chrome/icons/default/*.ico $(RES)/chrome/icons/default/
314
315         @# XPCOM
316         mkdir $(RES)/components
317         cp $(SRC)/Resources/components/*.xpt $(RES)/components/
318 ifeq (mac, $(PLATFORM))
319         cp $(SRC)/Resources/components/*.dylib $(RES)/components/
320 endif
321 ifeq (win, $(PLATFORM))
322         cp $(SRC)/Resources/components/*.dll $(RES)/components/
323 endif
324 ifeq (linux, $(PLATFORM))
325         cp $(SRC)/Resources/components/*.so $(RES)/components/
326 endif
327         cp $(SRC)/Resources/components/*.js $(RES)/components/
328
329         @# Create DMG for Macs
330 ifeq (mac, $(PLATFORM))
331         ln -s /Applications $(BUILD)/Applications
332         cp mac_installer/install-pane-$(INTL_SHORT).png $(BUILD)/.i.png
333         cp mac_installer/DS_Store $(BUILD)/.DS_Store
334         rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
335         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
336                 -format UDZO -imagekey zlib-level=9 \
337                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
338 endif
339
340         @# Create NSIS installer for Windows
341 ifeq (win, $(PLATFORM))
342
343         perl win_installer/strsub.pl win_installer/strings.nsh \
344                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
345                 $(BUILD)/strings-temp.nsh
346         perl win_installer/utf16.pl \
347                 $(BUILD)/strings-temp.nsh > \
348                 $(BUILD)/strings.nsh
349         rm $(BUILD)/strings-temp.nsh
350
351         perl win_installer/strsub.pl win_installer/config.ini \
352                 $(SRC)/Resources/chrome/locale/$(INTL)/installer.properties > \
353                 $(BUILD)/config-temp.ini
354         perl win_installer/utf16.pl \
355                 $(BUILD)/config-temp.ini > \
356                 $(BUILD)/config.ini
357         rm $(BUILD)/config-temp.ini
358
359         perl win_installer/utf16.pl \
360                 win_installer/build.nsi > \
361                 $(BUILD)/build.nsi
362
363         cp win_installer/vcredist_x86.exe $(BUILD)/vcredist_x86.exe
364
365         $(MAKE_NSIS) -DVERSION=$(VER) \
366                 -DVERSION_DATE=$(VER_DATE) \
367                 $(BUILD)/build.nsi
368
369         mv $(BUILD)/FlickrUploadr-$(VER)-XX.exe \
370                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).exe
371
372         rm $(BUILD)/build.nsi
373         rm $(BUILD)/strings.nsh
374         rm $(BUILD)/config.ini
375         rm $(BUILD)/vcredist_x86.exe
376 endif
377
378         @# Create ??? for Linux
379 ifeq (linux, $(PLATFORM))
380 endif
381
382
383
384 mar:
385
386         @echo "MAR step"
387         @# Making MAR files
388 ifeq (mac, $(PLATFORM))
389         @ln -s Flickr\ Uploadr.app $(BUILD)/new
390 endif
391 ifeq (win, $(PLATFORM))
392         @# In Windows, `ln -s ...` == `cp -R ...`
393         @ln -s $(BUILD)/Flickr\ Uploadr $(BUILD)/new
394 endif
395 ifeq (linux, $(PLATFORM))
396         @ln -s Flickr\ Uploadr $(BUILD)/new
397 endif
398         @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar
399         @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
400                 $(MOZILLA)/tools/update-packaging/make_full_update.sh \
401                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar \
402                 $(BUILD)/new &> /dev/null
403 #       @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar
404 #       @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
405 #               $(MOZILLA)/tools/update-packaging/make_incremental_update.sh \
406 #               $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar \
407 #               $(BUILD)/old $(BUILD)/new &> /dev/null
408 ifeq (win, $(PLATFORM))
409         @rm -rf $(BUILD)/new
410 else
411         @rm $(BUILD)/new
412 endif
413
414         @# Size and hash for the XML file
415 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
416 #               awk '{print "$(INTL) complete size: ",$$5}'
417 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
418 #               awk '{print "$(INTL) complete MD5:  ",$$4}'
419 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
420 #               awk '{print "$(INTL) partial size: ",$$5}'
421 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
422 #               awk '{print "$(INTL) partial MD5:  ",$$4}'
Note: See TracBrowser for help on using the browser.