root/trunk/uploadr/README

Revision 358, 19.0 kB (checked in by calh, 2 years ago)

more windows installer build progress - all loadable files sensibly named. pass the language variable to NSIS rather than sed'ing. build installer in the build tree. copy icons into the build tree correctly

Line 
1 Flickr Uploadr
2
3 Copyright (c) 2007-2008 Yahoo! Inc.  All rights reserved.  This library is
4 free software; you can redistribute it and/or modify it under the terms of
5 the GNU General Public License (GPL), version 2 only.  This library is
6 distributed WITHOUT ANY WARRANTY, whether express or implied. See the GNU
7 GPL for more details (http://www.gnu.org/licenses/gpl.html)
8
9 ------------------------------------------------------------------------
10
11 This guide uses UPLOADR to indicate the root of the Flickr Uploadr
12 source tree on your filesystem.  It probably shouldn't contain spaces
13 (C:\Documents and Settings\you\My Documents\Flickr Uploadr is probably
14 a bad idea).
15
16 On Windows, you must use the MSys bash shell to build Uploadr.  Cygwin
17 is not supported.  Instructions for getting your MSys environment setup
18 are included below.
19
20 You can obtain the Flickr Uploadr source code from either a tarball or
21 from Subversion.
22
23 Download tarball:
24   http://flickr.com/tools/uploadr/
25
26 Checkout from Subversion:
27   $ svn co http://code.flickr.com/svn/trunk/uploadr UPLOADR
28
29
30 Windows Build Environment
31 ------------------------------------------------------------------------
32
33 If you're planning on building the third party libraries on windows
34 (graphics magick, exiv2, ffmepg) then you'll need to have MS Visual C++
35 version 8 or greater installed. Version 7 will work for the third party
36 libraries themselves, but version 8 is required for building the final
37 DLLs.
38
39 To build the installers and such, you'll need to install MSYS. Start
40 by going here:
41
42 http://sf.net/project/showfiles.php?group_id=2435
43
44 Choose 'MSYS Base System', then find the file called something like
45 'msysCORE-1.0.11-2007.01.19-1.tar.bz2'. Unzip this (get WinRaR if you
46 can't open it) and put it at C:\msys
47
48 Download the following files from the 'MSYS Base System' page:
49
50     MSYS-1.0.11-20071204.tar.bz2
51     bash-3.1-MSYS-1.0.11-1.tar.bz2
52     coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
53
54 And download these file from the 'MSYS Supplementary Tools' page:
55
56     perl-5.6.1-MSYS-1.0.11-1.tar.bz2
57     crypt-1.1-1-MSYS-1.0.11-1.tar.bz2
58
59 Version numbers may be higher. Unzip them into the same folder as
60 MSYS, overwriting any existing duplicate files.
61
62 When you launch MSYS via the batch file in its root folder, you should
63 be able to type 'perl -v' and get a Perl banner if all went well.
64
65 Follow these steps to get MSYS working with Visual Studio:
66
67 http://arrozcru.no-ip.org/ffmpeg_wiki/tiki-index.php?page=Fixing+msys
68
69 From the same download page, download the following packages:
70
71   From the MinGW Runtime section:
72       mingw-runtime-3.14.tar.gz
73
74   From the GNU Binutils section:
75       binutils-2.18.50-20080109-2.tar.gz
76
77   From the MinGW API for MS-Windows section:
78       w32api-3.11.tar.gz
79
80   From the GCC Version 4 / Technology Preview: gcc-4.2.1-sjlj-2 section:
81       gcc-core-4.2.1-sjlj-2.tar.gz
82       gcc-g++-4.2.1-sjlj-2.tar.gz
83
84 Unpack each package into C:\msys\mingw then go to C:\msys\mingw\bin\ and
85 rename:
86
87   c++-sjlj.exe to c++.exe
88   cpp-sjlj.exe to cpp.exe
89   g++-sjlj.exe to g++.exe
90   gcc-sjlj.exe to gcc.exe
91
92 Follow these instructions to make mingw work with msys:
93
94 http://arrozcru.no-ip.org/ffmpeg_wiki/tiki-index.php?page=Integrating+MinGW+with+MSys
95
96 You probably already have an SVN client, but if not, you can grab the
97 commandline one from here:
98
99   http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
100   svn-1.4.6-setup.exe (or a more recent version)
101
102 Once installed, typing 'svn --version' from a fresh MSYS shell should give
103 you a version banner.
104
105 Next you'll need a zip utility. Grab this zip file:
106
107   ftp://ftp.info-zip.org/pub/infozip/WIN32/zip232xN.zip
108
109 And copy zip.exe into msys/bin. Ok, all ready!
110
111
112 XULRunner
113 ------------------------------------------------------------------------
114
115 XULRunner trunk builds:
116   ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/
117
118 Note: You want the version *without* 'sdk' in the name.
119
120
121 Windows
122 -------
123
124 Download a version of XULRunner trunk and unzip it into:
125   UPLOADR/MacUploadr.app/Contents/Resources/
126
127 The XULRunner files (e.g. xulrunner.exe) should now be here:
128   UPLOADR/MacUploadr.app/Contents/Resources/xulrunner/
129
130 Make sure you unzip the file keeping directory paths intact. There should
131 be several folders inside the 'xulrunner' folder, including 'chrome',
132 'components', etc.
133
134
135 Mac
136 ---
137
138 Install the Mac version of XULRunner, which will live in
139 /Library/Frameworks.  Then pull it into your fake Uploadr distribution:
140   $ mkdir UPLOADR/MacUplaodr.app/Contents/Frameworks
141   $ sudo mv /Library/Frameworks/XUL.framework \
142     UPLOADR/MacUploadr.app/Contents/Frameworks
143
144 Install MacPorts if you haven't already:
145   http://svn.macosforge.org/repository/macports/downloads/MacPorts-1.5.0/
146
147 The Mozilla tools require the IDL library:
148   $ sudo port install libidl
149
150
151
152 Gecko SDK
153 ------------------------------------------------------------------------
154
155 To build the XPCOM components you will need the Gecko SDK.  For PPC Mac
156 and Windows:
157   http://developer.mozilla.org/en/docs/Gecko_SDK#Downloading
158
159 For Intel Mac:
160   http://www.oxymoronical.com/view/1114
161
162 Place the SDK(s) appropriately:
163   UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.mac (Intel Mac)
164   UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.ppc (PPC Mac)
165   UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.win (Windows)
166
167 These SDKs are from the Gecko 1.8 series and so are only safe to use
168 if the XPCOM components use only frozen interfaces.  Fortunately,
169 Uploadr currently falls into this category.
170
171
172 Under Windows, you'll also need bits from Mozilla's Wintools:
173   http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip
174
175 Extract that and copy glib-1.2.dll and libIDL-0.6.dll from
176 wintools/buildtools/windows/bin/x86/ to your gecko-sdk.win/bin/ directory.
177
178
179
180 API Keys
181 ------------------------------------------------------------------------
182
183 You'll need your own API key and secret from Flickr to build Uploadr.
184 These can be obtained at http://flickr.com/services/api/.  The key
185 and secret must be placed in flKey.cpp as indicated:
186   UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp
187
188 The API key is stored as a string.  The secret is stored as individual
189 characters so it is not easily readable from the binary.
190
191 There are blocks to keep both a Windows and Mac key/secret in the same
192 source file (you certainly don't have to, though).  This is mainly
193 important for the official builds.
194
195
196
197 GraphicsMagick
198 ------------------------------------------------------------------------
199
200 Windows
201 -------
202
203 Download GraphicsMagick Windows SOURCE:
204   ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/
205
206 You'll need MS Visual C++ to build GraphicsMagick. We've built it
207 sucessfully using VC++ 7 and 8, but other versions may work fine.
208
209 Go to the VisualMagick/configure directory of the GraphicsMagick Windows
210 source directory.  Open configure.vcproj in Visual Studio and edit the
211 project configuration:
212
213   o Set the active configuration to "Release"
214   o Change the Use of MFC under Configuration Properties > General to
215     "Use MFC in a Static Library"
216   o Change the Runtime Library under Configuration Properties > C/C++ >
217     Code Generation to "Multi-threaded (/MT)"
218
219 Build the project and then run the configuration program (called
220 configure.exe, in the same folder as the .vcproj file). Select "Static
221 Multi-threaded runtimes" and otherwise accept the defaults.  This will
222 create your solution (project file) for Visual Studio in the root
223 GraphicsMagick folder. It should be called 'VisualStaticMT.sln'.
224
225 Open the solution and let Visual Studio 8 have its way with the Visual
226 Studio 7 solution file.  Edit the project configuration:
227
228   o Set the active configuration to "Release" for 'All'
229   o Change the Runtime Library for the CORE_Magick++ project under
230     Configuration Properties > C/C++ > Code Generation to
231     "Multi-threaded DLL (/MD)"
232   o Tell all of the CORE_* projects to optimize for speed under
233     Configuration Properties > C/C++ > Optimization
234     (Optimization: "Maximize Speed /O2")
235
236 Build it to see where the problems are.  As of 1.1.8, 18 out of 20
237 projects build properly.  The two that do not are utilities that are
238 extraneous.  In 1.1.7, the errors that will likely show up in a
239 try/catch block can be fixed by changing "exception" to "std::exception"
240 and adding "&" to make all of the catches happen by reference.  The
241 official builds are build with 1.1.10 and will soon move to 1.1.11.
242
243 You can verify that enough of it built correctly by checking in the
244 VisualMagick\lib directory. There should be a .lib file for each
245 CORE_* project.
246
247 Add the path to your GraphicsMagick build's VisualMagick\lib directory
248 to your library path.  Add the path to VisualMagick\include to your
249 include path.
250
251 The magic.mgk, modules.mgk and delegates.mgk files must be in the root of
252 the application (next to application.ini).  These files are included in
253 the tarball and Subversion checkouts, so you shouldn't have to worry. You
254 can otherwise find them in the VisualMagick\bin directory.
255
256
257 Mac
258 ---
259
260 Install prerequisites with MacPorts:
261   $ sudo port install jpeg configure.flags=-O3
262   $ sudo port install tiff configure.flags=-O3
263   $ sudo port install libpng
264
265 Download GraphicsMagick source:
266   ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/
267
268 Configure and install GraphicsMagick:
269   $ ./configure \
270     CFLAGS="-O3" \
271     CXXFLAGS="-O3" \
272     CPPFLAGS="-I/opt/local/include -I/usr/local/include" \
273     LDFLAGS="-L/opt/local/lib -L/usr/local/lib" \
274     --without-x --without-perl \
275     --disable-installed \
276     --without-dps --without-fpx --without-jbig --without-jp2 \
277     --without-lcms --without-trio --without-ttf --without-wmf \
278     --with-quantum-depth=16
279   $ make && sudo make install
280
281 Because of dynamic/static linker weirdness, after building GraphicsMagick,
282 move libjpeg.dylib, libtiff.dylib and libpng.dylib out of the way:
283   $ sudo mv /opt/local/lib/libjpeg.dylib /opt/local/lib/libjpeg.dylib.sav
284   $ sudo mv /opt/local/lib/libtiff.dylib /opt/local/lib/libtiff.dylib.sav
285   $ sudo mv /opt/local/lib/libpng.dylib /opt/local/lib/libpng.dylib.sav
286
287 For Mac, the magic.mgk, modules.mgk and delegates.mgk files must be in
288 Contents/lib/GraphicsMagick-<version>/config/.  Like on Windows, these
289 are included in the tarball/Subversion trees.
290
291
292
293 Exiv2
294 ------------------------------------------------------------------------
295
296 Download Exiv2 source from:
297   http://exiv2.org/download.html
298
299 Windows
300 -------
301
302 Download and install Expat for Windows:
303   http://sourceforge.net/project/showfiles.php?group_id=10127
304
305 Open up the solution file at 'msvc\exiv2.sln'. Just like GraphicsMagick,
306 let Visual Studio 8 eat the 7.1 project files. Edit the project
307 configuration:
308
309   o Disable every project in the Exiv2 solution except exiv2lib and xmpsdk
310     (Use the configuration manager and uncheck the boxes)
311   o Change the Runtime Library for remaining projects under
312     Configuration Properties > C/C++ > Code Generation to
313     "Multi-threaded DLL (/MD)"
314   o Set remaining projects to their Release state
315   o Modify the xmpsdk project:
316       o Change Configuration Properties > C/C++ > General >
317         Additional Include Directories to (all one line):
318         "..\..\..\expat-2.0.1\lib;..\..\xmpsdk\src;..\..\xmpsdk\include;"
319         "C:\Program Files\Expat 2.0.1\Source\lib"
320         (the last path portion might be different, depending on where
321         you install expat).
322       o Change Configuration Properties > Librarian > General >
323         Additional Dependencies to "libexpat.lib"
324       o Change Configuration Properties > Librarian > General >
325         Additional Library Directories to:
326         "$(SolutionDir)/lib";"C:\Program Files\Expat 2.0.1\Bin"
327   o Modify the exiv2lib project:
328       o Change Configuration Properties > Librarian > General >
329         Link Library Dependencies to "Yes" (VC7 doesn't seem to have
330         this option - just skip it)
331       o Change Configuration Properties > C/C++ > General >
332         Additional Include Directories to:
333         "..\..\src;..\..;..\..\xmpsdk\include"
334
335 You should now be able to build the solution. It should produce the
336 following files:
337
338         msvc\exiv2lib\Release\exiv2.lib
339         msvc\xmpsdk\Release\xmpsdk.lib
340
341 Copy libexpat.dll from "C:\Program Files\Expat 2.0.1\Bin" to
342 "UPLOADR\MacUploadr.app\Contents\Resources".
343
344
345 Mac
346 ---
347
348 In Unix-land, it's easy!
349   $ sudo port install libiconv
350   $ sudo port install expat
351   $ sudo port install xml2
352   $ ./configure --disable-shared --with-expat=/opt/local
353   $ make && sudo make install
354
355 Again because of static linker weirdness, after building Exiv2, move the
356 dynamic libraries out of the way:
357   $ sudo mv /opt/local/lib/libiconv.dylib /opt/local/lib/libiconv.dylib.sav
358   $ sudo mv /opt/local/lib/libexpat.dylib /opt/local/lib/libexpat.dylib.sav
359   $ sudo mv /opt/local/lib/libxml2.dylib /opt/local/lib/libxml2.dylib.sav
360
361
362
363 FFmpeg
364 ------------------------------------------------------------------------
365
366 Windows
367 -------
368
369 FFmpeg will not build in Visual Studio but can be linked by Visual
370 Studio, so we'll need to use MSys/WinGW.
371
372 --- I'm dubious that we need to install anything extra here [CAL]
373 --- But i need to wait until i actually get gm.dll linking
374 --- Additionally add in dependencies like zlib:
375 ---   http://wiki.videolan.org/Win32CompileMSYS
376
377 Check out and build the magic version of FFmpeg:
378 (handy hint: Shift+Insert pastes into the MSYS shell)
379
380   $ svn co -r 10885 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
381   $ cd ffmpeg
382   $ ./configure --disable-ffserver --disable-ffplay --enable-gpl \
383     --enable-memalign-hack --enable-static --disable-shared \
384     --disable-debug
385   $ make && make install
386
387 The Uploadr Visual Studio project is setup to expect the MinGW bits for
388 linking FFmpeg into the flGM XPCOM object.
389
390
391 Mac
392 ---
393
394 Check out the magic version of FFmpeg:
395   $ svn co -r 10885 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
396   $ cd ffmpeg
397
398 Then build:
399   $ ./configure --disable-ffserver --disable-ffplay --enable-gpl \
400     --disable-vhook --disable-mmx --enable-static --disable-shared \
401     --extra-cflags=-fno-common --disable-debug
402   $ make && sudo make install
403
404
405
406 Building XPCOM components
407 ------------------------------------------------------------------------
408
409 If you make any changes to the IDL files defining the XPCOM interfaces,
410 you must increment the BuildID defined in:
411   UPLOADR/MacUploadr.app/Contents/Resources/application.ini
412
413 Windows
414 -------
415
416 Use the Visual Studio projects in:
417   UPLOADR/MacUploadr.app/Contents/Resources/components/*.vcproj
418
419 The two projects will generate gm.dll and key.dll.
420
421 Mac
422 ---
423
424 Use the Makefile in:
425   UPLOADR/MacUploadr.app/Contents/Resources/components/
426
427 Running `make ppc gm ; make ppc key` will build the PPC binaries as
428 gm.dylib.ppc and key.dylib.ppc.  `make mac gm ; make mac key` will
429 build gm.dylib.mac and key.dylib.mac.  These architecture-dependent
430 files can be combined on an Intel Mac to leave gm.dylib and key.dylib
431 by running `make universal gm ; make universal key`.
432
433
434
435 Running Flickr Uploadr
436 ------------------------------------------------------------------------
437
438 Windows
439 -------
440
441 Copy xulrunner-stub.exe from the xulrunner/ directory into the root
442 of your app, UPLOADR/MacUploadr.app/Contents/Resources/, rename it to
443 "Flickr Uploadr.exe" and double-click it to run Uploadr.
444
445 You can hack the icons.ico file into the executable using Resource
446 Hacker:
447   http://angusj.com/resourcehacker/
448
449 Create a shortcut to this executable and append the "-console
450 -jsconsole" parameters to launch Uploadr with both debug windows open.
451
452 Mac
453 ---
454
455 The app can be launched by double-clicking on MacUploadr.app in Finder.
456
457 Launch Uploadr from Terminal to get debug windows:
458   $ MacUploadr.app/Contents/MacOS/xulrunner -jsconsole
459
460
461
462 Translations
463 ------------------------------------------------------------------------
464
465 I've just been pulling the translated DTD and PROPERTIES files from a
466 production WWW server and running them through strings_import.php.
467
468 Note that in the German translation, the help page is messed up because
469 they insist on removing the ^^ wrappers around some sections of the
470 text.  Replace these or you'll see "undefined" in several places in the
471 UI.
472
473 Also note that " must be escaped with &#34;.  This led me to believe
474 that & could be escaped with &#38; but this is not the case.  Don't
475 use & in the main.dtd files - spell out "and" instead.
476
477
478
479 Packaging
480 ------------------------------------------------------------------------
481
482 Windows
483 -------
484
485 Windows installers are created using NSIS, specifically the Unicode
486 version available here:
487   http://www.scratchpaper.com/
488
489 Building the NSIS package will likely fail if you do not have Visual
490 Studio 8 installed.  The installer references vcredist_x86.exe.  For
491 controlled experimentation it is OK to omit this installation step by
492 commenting line 110 in UPLOADR/windows_install_build.nsi.
493
494 One-command builds in MSys for all eight languages:
495   $ make win all
496
497 If you do not want to create update files (see below):
498   $ make win all-build
499
500 Mac
501 ---
502
503 The nice background image for the DMGs must be recreated each time you
504 change version numbers.
505   o Start Disk Utility and create a new image called "Flickr Uploadr
506     $(VERSION)" (substitute your version)
507   o Create a folder there called "Flickr Uploadr.app" and a symbolic
508     link called "Applications"
509   o Copy one of the installer images from mac_installer/ in as ".i.png"
510   o Create a symbolic link to that image as "i.png"
511   o Open the image with Finder and press Command+J to set folder options
512       o Select "This window only"
513       o Set the "Icon size" to 128px
514       o Uncheck "Snap to grid"
515       o Set the background picture to your "i.png" symbolic link (this
516         is rather finicky)
517       o Close the settings window
518   o Delete the "i.png" symbolic link (the hidden file will remain)
519   o Arrange the icons appropriately
520   o Close the window
521
522 After all of that, copy the .DS_Store file into your source tree, the
523 Makefile will take care of everything else (substitute your version):
524   $ cp /Volumes/Flickr\ Uploadr\ $(VERSION)/.DS_Store \
525     UPLOADR/mac_installer/DS_Store
526
527 Unmount and delete the disk image you created.
528
529 One-command builds for all eight languages:
530   $ make mac all
531
532 If you do not want to create update files (see below):
533   $ make mac all-build
534
535
536
537 Software Update
538 ------------------------------------------------------------------------
539
540 Uploadr phones home to Flickr about once a day to check for updates,
541 available as MAR files.  Details:
542   http://wiki.mozilla.org/Software_Update
543
544 Actually creating software updates means actually building Mozilla.
545 This is not for the faint of heart.
546
547 Start by satisfying prerequisites for your platform:
548   http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites
549   http://developer.mozilla.org/en/docs/Mac_OS_X_Build_Prerequisites
550
551 Configure your build, using the UPLOADR/mozconfig file.  Make sure to
552 comment the Mac-specific line if you're on Windows:
553   http://developer.mozilla.org/en/docs/Configuring_Build_Options
554
555 Now checkout and build Mozilla:
556   $ cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot \
557     co mozilla/client.mk
558   $ cd mozilla
559   $ make -f client.mk checkout
560   $ make -f client.mk build
561
562 Once you have your Mozilla tree built, the Packaging section above can
563 complete properly.  Alternatively, if you just want to build the MAR
564 files:
565   $ make win all-mar
566   --OR--
567   $ make mac all-mar
Note: See TracBrowser for help on using the browser.