root/trunk/uploadr/Makefile

Revision 568, 14.0 kB (checked in by jdecq, 8 months ago)

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