root/trunk/uploadr/Makefile

Revision 324, 10.5 kB (checked in by rcrowley, 2 years ago)

Updated version number and locked down the extension update stuff (blank right now, but ready for the future)

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, $(MAKECMDGOALS))
15 ifeq (de-de, $(INTL))
16 INTL_SHORT := de
17 INTL_WIN := German
18 endif
19 ifeq (en-US, $(INTL))
20 INTL_SHORT := en
21 INTL_WIN := English
22 endif
23 ifeq (es-us, $(INTL))
24 INTL_SHORT := es
25 INTL_WIN := Spanish
26 endif
27 ifeq (fr-fr, $(INTL))
28 INTL_SHORT := fr
29 INTL_WIN := French
30 endif
31 ifeq (it-it, $(INTL))
32 INTL_SHORT := it
33 INTL_WIN := Italian
34 endif
35 ifeq (ko-kr, $(INTL))
36 INTL_SHORT := kr
37 INTL_WIN := Korean
38 endif
39 ifeq (pt-br, $(INTL))
40 INTL_SHORT := br
41 INTL_WIN := PortugueseBR
42 endif
43 ifeq (zh-hk, $(INTL))
44 INTL_SHORT := hk
45 INTL_WIN := TradChinese
46 endif
47
48
49
50 ########################################################################
51 ########################################################################
52 # Configuration
53
54 # Version number for Uploadr
55 VER := 3.1
56
57 # Source files
58 #   Even though this isn't a very Windows-y path, it makes life
59 #   simpler to use it on all platforms
60 SRC := MacUploadr.app/Contents
61
62 ########################################################################
63 # Windows configuration
64
65 ifeq (win, $(filter win, $(MAKECMDGOALS)))
66 PLATFORM := win
67
68 # Dated version for the NSIS installer
69 VER_DATE := 2008.04.03.01
70
71 # Location of Mozilla tree for the MAR tools
72 MOZILLA := /c/mozilla
73
74 # Location for build staging
75 #   The base of this path must exist before running make
76 BUILD := /c/code/uploadr/builds/$(INTL)
77
78 # Location for application bundle staging
79 APP := $(BUILD)/Flickr\ Uploadr
80
81 # Location for resource file (chrome, components, etc) staging
82 RES := $(APP)
83
84 # Location to output finished DMGs
85 OUT := /c/code/uploadr
86
87 # End Windows configuration
88 ########################################################################
89
90 ########################################################################
91 # Mac configuration
92
93 else
94 PLATFORM := mac
95
96 # GraphicsMagick version for stupid directory structure
97 GM_VER := 1.1.10
98
99 # Location of Mozilla tree for the MAR tools
100 MOZILLA := ~/mozilla
101
102 # Location for build staging
103 #   The base of this path must exist before running make
104 BUILD := ~/Desktop/builds/$(INTL)
105
106 # Location for application bundle staging
107 APP := $(BUILD)/Flickr\ Uploadr.app
108
109 # Location for resource file (chrome, components, etc) staging
110 RES := $(APP)/Contents/Resources
111
112 # Location to output finished DMGs
113 OUT := ~/Desktop
114
115 # End Mac configuration
116 ########################################################################
117
118 endif
119
120 # End configuration
121 ########################################################################
122 ########################################################################
123
124
125
126 dummy:
127         @echo "Nothing happens if you don't give some arguments!"
128         @echo "  win all, mac all:   Build the whole thing"
129         @echo "  build, mar: Build a single package or update but requires"
130         @echo "              de-de, en-US, es-us, fr-fr, it-it, ko-kr, pt-br, or zh-hk"
131
132 all: all-build all-mar
133
134 mac:
135         @echo "Building for Mac"
136 win:
137         @echo "Building for Windows"
138
139 all-build:
140         make $(PLATFORM) de-de build
141         make $(PLATFORM) en-US build
142         make $(PLATFORM) es-us build
143         make $(PLATFORM) fr-fr build
144         make $(PLATFORM) it-it build
145         make $(PLATFORM) ko-kr build
146         make $(PLATFORM) pt-br build
147         make $(PLATFORM) zh-hk build
148
149 all-mar:
150         @make $(PLATFORM) de-de mar
151         @make $(PLATFORM) en-US mar
152         @make $(PLATFORM) es-us mar
153         @make $(PLATFORM) fr-fr mar
154         @make $(PLATFORM) it-it mar
155         @make $(PLATFORM) ko-kr mar
156         @make $(PLATFORM) pt-br mar
157         @make $(PLATFORM) zh-hk mar
158
159
160
161 de-de:
162         @echo "Building German (de-de)"
163 en-US:
164         @echo "Building English (en-US)"
165 es-us:
166         @echo "Building Spanish (es-us)"
167 fr-fr:
168         @echo "Building French (fr-fr)"
169 it-it:
170         @echo "Building Italian (it-it)"
171 ko-kr:
172         @echo "Building Korean (ko-kr)"
173 pt-br:
174         @echo "Building Portuguese (pt-br)"
175 zh-hk:
176         @echo "Building Chinese (zh-hk)"
177
178
179
180 build:
181
182         @# Make sure the package directory exists
183         mkdir -p $(BUILD)
184
185         @# Saving the previous version for the partial MAR
186 #       rm -rf $(BUILD)/old
187 #       mv $(APP) $(BUILD)/old
188         rm -rf $(APP)
189 ifeq (mac, $(PLATFORM))
190         rm -f $(BUILD)/Applications
191 endif
192
193         @# Package structure
194 ifeq (mac, $(PLATFORM))
195         mkdir -p $(APP)/Contents
196         mkdir $(APP)/Contents/lib
197         mkdir $(APP)/Contents/Frameworks
198         mkdir $(APP)/Contents/MacOS
199         mkdir $(RES)
200         cp $(SRC)/Info.plist $(APP)/Contents/
201 else
202         mkdir $(APP)
203 endif
204
205         @# GraphicsMagick config files
206 ifeq (mac, $(PLATFORM))
207         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)
208         mkdir $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config
209         cp $(SRC)/lib/GraphicsMagick-$(GM_VER)/config/*.mgk \
210                 $(APP)/Contents/lib/GraphicsMagick-$(GM_VER)/config/
211 else
212         cp $(SRC)/Resources/*.mgk $(RES)/
213 endif
214
215         @# XULRunner
216 ifeq (mac, $(PLATFORM))
217         cp -R $(SRC)/Frameworks/XUL.framework $(APP)/Contents/Frameworks/
218         cp $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/xulrunner \
219                 $(APP)/Contents/MacOS/xulrunner
220         cp $(SRC)/Resources/application.ini $(RES)/
221         cp $(SRC)/Resources/LICENSE.txt $(RES)/
222         cp $(SRC)/Resources/icons.icns $(RES)/
223 else
224         cp -R $(SRC)/Resources/xulrunner $(RES)/
225         cp $(SRC)/Resources/Flickr\ Uploadr.exe $(RES)/
226 endif
227
228         @# XULRunner preferences
229         mkdir -p $(RES)/defaults/preferences
230         cp $(SRC)/Resources/defaults/preferences/*.js \
231                 $(RES)/defaults/preferences/
232         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/defaults/preferences/prefs.js > \
233                 $(RES)/defaults/preferences/prefs.js
234
235         @# XULRunner locale
236 ifeq (mac, $(PLATFORM))
237         rm $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/??-??.*
238         cp ./xulrunner_locales/$(INTL).* \
239                 $(APP)/Contents/Frameworks/XUL.framework/Versions/Current/chrome/
240 else
241         rm $(RES)/xulrunner/chrome/??-??.*
242         cp ./xulrunner_locales/$(INTL).* $(RES)/xulrunner/chrome/
243 endif
244
245         @# Chrome
246         mkdir $(RES)/chrome
247         mkdir content
248         mkdir content/uploadr
249         cp $(SRC)/Resources/chrome/content/uploadr/*.* content/uploadr/
250         mkdir content/hacks
251 ifeq (mac, $(PLATFORM))
252         mkdir content/hacks/mac
253         cp $(SRC)/Resources/chrome/content/hacks/mac/*.xul content/hacks/mac/
254 #       cp $(SRC)/Resources/chrome/content/hacks/mac/*.js content/hacks/mac/
255 endif
256 ifeq (win, $(PLATFORM))
257         mkdir content/hacks/win
258         cp $(SRC)/Resources/chrome/content/hacks/win/*.xul content/hacks/win/
259 #       cp $(SRC)/Resources/chrome/content/hacks/win/*.js content/hacks/win/
260 endif
261 ifeq (linux, $(PLATFORM))
262         mkdir content/hacks/unix
263         cp $(SRC)/Resources/chrome/content/hacks/unix/*.xul content/hacks/unix/
264 #       cp $(SRC)/Resources/chrome/content/hacks/unix/*.js content/hacks/unix/
265 endif
266         mkdir locale
267         mkdir locale/branding
268         cp $(SRC)/Resources/chrome/locale/branding/*.* locale/branding/
269         mkdir locale/$(INTL)
270         cp $(SRC)/Resources/chrome/locale/$(INTL)/*.* locale/$(INTL)/
271         sed 's/en-US/$(INTL)/g' $(SRC)/Resources/chrome/chrome.manifest.prod > \
272                 $(RES)/chrome/chrome.manifest
273         mkdir skin
274 #ifeq (mac, $(PLATFORM))
275 #       mkdir skin/hacks
276 #       mkdir skin/hacks/mac
277 #       cp $(SRC)/Resources/chrome/skin/hacks/mac/hacks.css skin/hacks/mac/
278 #endif
279 #ifeq (win, $(PLATFORM))
280 #       mkdir skin/hacks/win
281 #       cp $(SRC)/Resources/chrome/skin/hacks/win/hacks.css skin/hacks/win/
282 #endif
283 #ifeq (linux, $(PLATFORM))
284 #       mkdir skin/hacks/unix
285 #       cp $(SRC)/Resources/chrome/skin/hacks/unix/hacks.css skin/hacks/unix/
286 #endif
287         mkdir skin/uploadr
288         cp $(SRC)/Resources/chrome/skin/uploadr/*.css skin/uploadr/
289         cp $(SRC)/Resources/chrome/skin/uploadr/*.gif skin/uploadr/
290         cp $(SRC)/Resources/chrome/skin/uploadr/*.png skin/uploadr/
291 ifeq (win, $(PLATFORM))
292         /c/Program\ Files/7-Zip/7z.exe a -r uploadr.zip content locale skin
293 else
294         zip uploadr -r content locale skin
295 endif
296         rm -rf content locale skin
297         mv uploadr.zip $(RES)/chrome/uploadr.jar
298
299         @# XPCOM
300         mkdir $(RES)/components
301         cp $(SRC)/Resources/components/*.xpt $(RES)/components/
302 ifeq (mac, $(PLATFORM))
303         cp $(SRC)/Resources/components/*.dylib $(RES)/components/
304 endif
305 ifeq (win, $(PLATFORM))
306         cp $(SRC)/Resources/components/*.dll $(RES)/components/
307 endif
308 ifeq (linux, $(PLATFORM))
309         cp $(SRC)/Resources/components/*.so $(RES)/components/
310 endif
311         cp $(SRC)/Resources/components/*.js $(RES)/components/
312
313         @# Create DMG for Macs
314 ifeq (mac, $(PLATFORM))
315         ln -s /Applications $(BUILD)/Applications
316         cp mac_installer/install-pane-$(INTL_SHORT).png $(BUILD)/.i.png
317         cp mac_installer/DS_Store $(BUILD)/.DS_Store
318         rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
319         hdiutil create -srcfolder $(BUILD) -volname "Flickr Uploadr $(VER)" \
320                 -format UDZO -imagekey zlib-level=9 \
321                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).dmg
322 endif
323
324         @# Create NSIS installer for Windows
325 ifeq (win, $(PLATFORM))
326         sed 's/English\.nsh/$(INTL_WIN)/g' windows_install_build.nsi > \
327                 windows_install_build_real.nsi
328         /c/Program\ Files/NSISUnicode/makensis.exe -DVERSION=$(VER) \
329                 -DVERSION_DATE=$(VER_DATE) windows_install_build_real.nsi
330         mv FlickrUploadr-$(VER)-XX.exe \
331                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).exe
332         rm windows_install_build_real.nsi
333 endif
334
335         @# Create ??? for Linux
336 ifeq (linux, $(PLATFORM))
337 endif
338
339
340
341 mar:
342
343         @# Making MAR files
344 ifeq (mac, $(PLATFORM))
345         @ln -s Flickr\ Uploadr.app $(BUILD)/new
346 endif
347 ifeq (win, $(PLATFORM))
348         @# In Windows, `ln -s ...` == `cp -R ...`
349         @ln -s $(BUILD)/Flickr\ Uploadr $(BUILD)/new
350 endif
351 ifeq (linux, $(PLATFORM))
352         @ln -s Flickr\ Uploadr $(BUILD)/new
353 endif
354         @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar
355         @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
356                 $(MOZILLA)/tools/update-packaging/make_full_update.sh \
357                 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar \
358                 $(BUILD)/new 2> /dev/null > /dev/null
359 #       @rm -f $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar
360 #       @PATH="$(PATH):$(MOZILLA)/other-licenses/bsdiff:$(MOZILLA)/modules/libmar/tool" \
361 #               $(MOZILLA)/tools/update-packaging/make_incremental_update.sh \
362 #               $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar \
363 #               $(BUILD)/old $(BUILD)/new 2> /dev/null > /dev/null
364 ifeq (win, $(PLATFORM))
365         @rm -rf $(BUILD)/new
366 else
367         @rm $(BUILD)/new
368 endif
369
370         @# Size and hash for the XML file
371 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
372 #               awk '{print "$(INTL) complete size: ",$$5}'
373 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).complete.mar | \
374 #               awk '{print "$(INTL) complete MD5:  ",$$4}'
375 #       @ls -l $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
376 #               awk '{print "$(INTL) partial size: ",$$5}'
377 #       @md5 $(OUT)/FlickrUploadr-$(VER)-$(INTL_SHORT).partial.mar | \
378 #               awk '{print "$(INTL) partial MD5:  ",$$4}'
Note: See TracBrowser for help on using the browser.