| 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 |
|
|---|
| 14 |
You can obtain the Flickr Uploadr source code from either a tarball or |
|---|
| 15 |
from Subversion. |
|---|
| 16 |
|
|---|
| 17 |
Download tarball: |
|---|
| 18 |
http://flickr.com/tools/uploadr/ |
|---|
| 19 |
|
|---|
| 20 |
Checkout from Subversion: |
|---|
| 21 |
$ svn co http://code.flickr.com/svn/trunk/uploadr UPLOADR |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
XULRunner |
|---|
| 25 |
------------------------------------------------------------------------ |
|---|
| 26 |
|
|---|
| 27 |
XULRunner trunk builds: |
|---|
| 28 |
ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/ |
|---|
| 29 |
|
|---|
| 30 |
Note: You want the version *without* 'sdk' in the name. |
|---|
| 31 |
|
|---|
| 32 |
Install the Mac version of XULRunner, which will live in |
|---|
| 33 |
/Library/Frameworks. Then pull it into your fake Uploadr distribution: |
|---|
| 34 |
$ mkdir UPLOADR/MacUploadr.app/Contents/Frameworks |
|---|
| 35 |
$ sudo mv /Library/Frameworks/XUL.framework \ |
|---|
| 36 |
UPLOADR/MacUploadr.app/Contents/Frameworks |
|---|
| 37 |
|
|---|
| 38 |
Install MacPorts if you haven't already: |
|---|
| 39 |
http://svn.macosforge.org/repository/macports/downloads/MacPorts-1.5.0/ |
|---|
| 40 |
|
|---|
| 41 |
The Mozilla tools require the IDL library: |
|---|
| 42 |
$ sudo port install libidl (sudo /opt/local/bin/port install libidl) |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
Gecko SDK |
|---|
| 46 |
------------------------------------------------------------------------ |
|---|
| 47 |
|
|---|
| 48 |
To build the XPCOM components you will need the Gecko SDK. For PPC Mac: |
|---|
| 49 |
http://developer.mozilla.org/en/docs/Gecko_SDK#Downloading |
|---|
| 50 |
|
|---|
| 51 |
For Intel Mac: |
|---|
| 52 |
http://developer.mozilla.org/en/docs/Gecko_SDK#Downloading |
|---|
| 53 |
was http://www.oxymoronical.com/view/1114 |
|---|
| 54 |
|
|---|
| 55 |
Place the SDK(s) appropriately: |
|---|
| 56 |
UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.mac (Intel Mac) |
|---|
| 57 |
UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.ppc (PPC Mac) |
|---|
| 58 |
|
|---|
| 59 |
These SDKs are from the Gecko 1.8/1.9 series and so are only safe to use |
|---|
| 60 |
if the XPCOM components use only frozen interfaces. Fortunately, |
|---|
| 61 |
Uploadr currently falls into this category. |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
API Keys |
|---|
| 65 |
------------------------------------------------------------------------ |
|---|
| 66 |
|
|---|
| 67 |
You'll need your own API key and secret from Flickr to build Uploadr. |
|---|
| 68 |
These can be obtained at http://flickr.com/services/api/. The key |
|---|
| 69 |
and secret must be placed in flKey.cpp in the spaces provided. Copy |
|---|
| 70 |
flKey.cpp.template to flKey.cpp and insert your keys: |
|---|
| 71 |
|
|---|
| 72 |
UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp.template |
|---|
| 73 |
UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp |
|---|
| 74 |
|
|---|
| 75 |
The API key is stored as a string. The secret is stored as individual |
|---|
| 76 |
characters so it is not easily readable from the binary. |
|---|
| 77 |
|
|---|
| 78 |
There are blocks to keep both a Windows and Mac key/secret in the same |
|---|
| 79 |
source file (you certainly don't have to, though). This is mainly |
|---|
| 80 |
important for the official builds. |
|---|
| 81 |
|
|---|
| 82 |
Libintl static linking |
|---|
| 83 |
------------------------------------------------------------------------ |
|---|
| 84 |
Because of dynamic/static linker weirdness, before building GraphicsMagick, |
|---|
| 85 |
and Exiv, move libintl.dylibout of the way: |
|---|
| 86 |
$ sudo mv /opt/local/lib/libintl.dylib /opt/local/lib/libintl.dylib.sav |
|---|
| 87 |
you might need to do that for all the versions of libintl you have on your system |
|---|
| 88 |
|
|---|
| 89 |
GraphicsMagick |
|---|
| 90 |
------------------------------------------------------------------------ |
|---|
| 91 |
|
|---|
| 92 |
Install prerequisites with MacPorts: |
|---|
| 93 |
$ sudo port install jpeg configure.flags=-O3 |
|---|
| 94 |
$ sudo port install tiff configure.flags=-O3 |
|---|
| 95 |
$ sudo port install libpng |
|---|
| 96 |
|
|---|
| 97 |
Download GraphicsMagick source (try and stick with 1.1.10): |
|---|
| 98 |
ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.1/GraphicsMagick-1.1.10.tar.bz2 |
|---|
| 99 |
|
|---|
| 100 |
jde - trying 1.2.5 (ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.2/GraphicsMagick-1.2.5.tar.bz2) to match WINDOWS |
|---|
| 101 |
|
|---|
| 102 |
Configure and install GraphicsMagick: |
|---|
| 103 |
$ ./configure \ |
|---|
| 104 |
CFLAGS="-O3" \ |
|---|
| 105 |
CXXFLAGS="-O3" \ |
|---|
| 106 |
CPPFLAGS="-I/opt/local/include -I/usr/local/include" \ |
|---|
| 107 |
LDFLAGS="-L/opt/local/lib -L/usr/local/lib" \ |
|---|
| 108 |
--without-x --without-perl \ |
|---|
| 109 |
--disable-installed \ |
|---|
| 110 |
--without-dps --without-fpx --without-jbig --without-jp2 \ |
|---|
| 111 |
--without-lcms --without-trio --without-ttf --without-wmf \ |
|---|
| 112 |
--with-quantum-depth=16 |
|---|
| 113 |
$ make && sudo make install |
|---|
| 114 |
|
|---|
| 115 |
Because of dynamic/static linker weirdness, after building GraphicsMagick, |
|---|
| 116 |
move libjpeg.dylib, libtiff.dylib and libpng.dylib out of the way: |
|---|
| 117 |
$ sudo mv /opt/local/lib/libjpeg.dylib /opt/local/lib/libjpeg.dylib.sav |
|---|
| 118 |
$ sudo mv /opt/local/lib/libtiff.dylib /opt/local/lib/libtiff.dylib.sav |
|---|
| 119 |
$ sudo mv /opt/local/lib/libpng.dylib /opt/local/lib/libpng.dylib.sav |
|---|
| 120 |
|
|---|
| 121 |
For Mac, the magic.mgk, modules.mgk and delegates.mgk files must be in |
|---|
| 122 |
Contents/lib/GraphicsMagick-<version>/config/. Like on Windows, these |
|---|
| 123 |
are included in the tarball/Subversion trees. |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
Exiv2 |
|---|
| 128 |
------------------------------------------------------------------------ |
|---|
| 129 |
|
|---|
| 130 |
Download Exiv2 source from: |
|---|
| 131 |
http://exiv2.org/download.html |
|---|
| 132 |
|
|---|
| 133 |
In Unix-land, it's easy! |
|---|
| 134 |
$ sudo port install libiconv |
|---|
| 135 |
$ sudo port install expat |
|---|
| 136 |
$ sudo port install xml2 (jde - does not exist: so libxml2?) |
|---|
| 137 |
$ ./configure --prefix=/opt/local --disable-shared --with-expat=/opt/local |
|---|
| 138 |
$ make && sudo make install |
|---|
| 139 |
|
|---|
| 140 |
Again because of static linker weirdness, after building Exiv2, move the |
|---|
| 141 |
dynamic libraries out of the way: |
|---|
| 142 |
$ sudo mv /opt/local/lib/libiconv.dylib /opt/local/lib/libiconv.dylib.sav |
|---|
| 143 |
$ sudo mv /opt/local/lib/libexpat.dylib /opt/local/lib/libexpat.dylib.sav |
|---|
| 144 |
$ sudo mv /opt/local/lib/libxml2.dylib /opt/local/lib/libxml2.dylib.sav |
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
FFmpeg |
|---|
| 148 |
------------------------------------------------------------------------ |
|---|
| 149 |
|
|---|
| 150 |
Check out the most recent version of FFmpeg: |
|---|
| 151 |
$ svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg |
|---|
| 152 |
$ cd ffmpeg |
|---|
| 153 |
|
|---|
| 154 |
Then build: |
|---|
| 155 |
$ ./configure --disable-ffserver --disable-ffplay --enable-gpl \ |
|---|
| 156 |
--disable-vhook --disable-mmx --enable-static --disable-shared \ |
|---|
| 157 |
--extra-cflags=-fno-common --disable-debug --enable-swscale |
|---|
| 158 |
$ make && sudo make install |
|---|
| 159 |
|
|---|
| 160 |
jde : encountered: |
|---|
| 161 |
> make(6189) malloc: *** vm_allocate(size=4272951296) failed (error |
|---|
| 162 |
> code=3) |
|---|
| 163 |
> make(6189) malloc: *** error: can't allocate region |
|---|
| 164 |
> make(6189) malloc: *** set a breakpoint in szone_error to debug |
|---|
| 165 |
> make: *** virtual memory exhausted. Stop. |
|---|
| 166 |
> |
|---|
| 167 |
|
|---|
| 168 |
$ which make |
|---|
| 169 |
/usr/bin/make |
|---|
| 170 |
$ make --version |
|---|
| 171 |
GNU Make 3.80 |
|---|
| 172 |
|
|---|
| 173 |
port install gmake |
|---|
| 174 |
$ which gmake |
|---|
| 175 |
/opt/local/bin/gmake |
|---|
| 176 |
$ gmake --version |
|---|
| 177 |
GNU Make 3.81 |
|---|
| 178 |
|
|---|
| 179 |
and used gmake instead of make |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
Building XPCOM components |
|---|
| 183 |
------------------------------------------------------------------------ |
|---|
| 184 |
|
|---|
| 185 |
If you make any changes to the IDL files defining the XPCOM interfaces, |
|---|
| 186 |
you must increment the BuildID defined in: |
|---|
| 187 |
UPLOADR/MacUploadr.app/Contents/Resources/application.ini |
|---|
| 188 |
|
|---|
| 189 |
Use the Makefile in: |
|---|
| 190 |
UPLOADR/MacUploadr.app/Contents/Resources/components/ |
|---|
| 191 |
|
|---|
| 192 |
http://developer.mozilla.org/en/docs/Gecko_SDK#Issues_with_the_OS_X_SDK |
|---|
| 193 |
|
|---|
| 194 |
Running `make ppc gm ; make ppc key` will build the PPC binaries as |
|---|
| 195 |
gm.dylib.ppc and key.dylib.ppc. `make mac gm ; make mac key` will |
|---|
| 196 |
build gm.dylib.mac and key.dylib.mac. These architecture-dependent |
|---|
| 197 |
files can be combined on an Intel Mac to leave gm.dylib and key.dylib |
|---|
| 198 |
by running `make universal gm ; make universal key`. |
|---|
| 199 |
|
|---|
| 200 |
Make sure by running otool -Lv that you are not depending on libintl, which is not intalled by default on Mac Os X |
|---|
| 201 |
|
|---|
| 202 |
Running Flickr Uploadr |
|---|
| 203 |
------------------------------------------------------------------------ |
|---|
| 204 |
|
|---|
| 205 |
The app can be launched by double-clicking on MacUploadr.app in Finder. |
|---|
| 206 |
|
|---|
| 207 |
Launch Uploadr from Terminal to get debug windows: |
|---|
| 208 |
$ chmod a+w MacUploadr.app/Contents/MacOS/xulrunner |
|---|
| 209 |
$ chmod a+x MacUploadr.app/Contents/MacOS/xulrunner |
|---|
| 210 |
$ MacUploadr.app/Contents/MacOS/xulrunner -jsconsole |
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
Packaging |
|---|
| 214 |
------------------------------------------------------------------------ |
|---|
| 215 |
|
|---|
| 216 |
The nice background image for the DMGs must be recreated each time you |
|---|
| 217 |
change version numbers. |
|---|
| 218 |
o Start Disk Utility and create a new image called "Flickr Uploadr |
|---|
| 219 |
$(VERSION)" (substitute your version) |
|---|
| 220 |
o Create a folder there called "Flickr Uploadr.app" and a symbolic |
|---|
| 221 |
link called "Applications" |
|---|
| 222 |
o Copy one of the installer images from mac_installer/ in as ".i.png" |
|---|
| 223 |
o Create a symbolic link to that image as "i.png" |
|---|
| 224 |
o Open the image with Finder and press Command+J to set folder options |
|---|
| 225 |
o Select "This window only" |
|---|
| 226 |
o Set the "Icon size" to 128px |
|---|
| 227 |
o Uncheck "Snap to grid" |
|---|
| 228 |
o Set the background picture to your "i.png" symbolic link (this |
|---|
| 229 |
is rather finicky) |
|---|
| 230 |
o Close the settings window |
|---|
| 231 |
o Delete the "i.png" symbolic link (the hidden file will remain) |
|---|
| 232 |
o Arrange the icons appropriately |
|---|
| 233 |
o Close the window |
|---|
| 234 |
|
|---|
| 235 |
After all of that, copy the .DS_Store file into your source tree, the |
|---|
| 236 |
Makefile will take care of everything else (substitute your version): |
|---|
| 237 |
$ cp /Volumes/Flickr\ Uploadr\ $(VERSION)/.DS_Store \ |
|---|
| 238 |
UPLOADR/mac_installer/DS_Store |
|---|
| 239 |
|
|---|
| 240 |
Unmount and delete the disk image you created. |
|---|
| 241 |
|
|---|
| 242 |
One-command builds for all eight languages: |
|---|
| 243 |
$ make mac all |
|---|
| 244 |
|
|---|
| 245 |
NOTE: This will fail at the MAR build steps, unless you have the Mozilla |
|---|
| 246 |
tools built and installed. See README.updates for this, or you can |
|---|
| 247 |
skip the MAR build step (recommended for outside developers): |
|---|
| 248 |
$ make mac all-build |
|---|
| 249 |
|
|---|
| 250 |
Or to build a single language: |
|---|
| 251 |
$ make mac build en-US |
|---|
| 252 |
|
|---|
| 253 |
|
|---|