Building Phonegap on Ubuntu
Phonegap is a cool set of tools (which I am about to try out for the first time) which lets you build applications in HTML / Javascript for Android and iPhones. I had some trouble installing out of the box on Ubuntu 9.10 (Karmic), so I thought I’d document my fix.
So first we configure:
1
./configure
You’ll first get an error like this:
1
2
3
Building PhoneGap Makefile
No Doxygen found; fetch it from http://www.doxygen.org/ and install it in /Applications
Run "make" to build
To fix this you first need to install doxygen:
1
sudo apt-get install doxygen
..then modify the Makefile to point at doxygen. On line ~19 you’ll fine DOXYGEN= pointing to nothing. Modify it to read:
1
DOXYGEN = /usr/bin/doxygen
Then run:
1
./configure && make
You’ll end up hitting errors such as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
java -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o lib/iphone/phonegap-min.js lib/iphone/phonegap.js
[ERROR] 1072:9:missing ; before statement
[ERROR] 1073:14:syntax error
[ERROR] 1074:1:syntax error
[ERROR] 1183:14:missing ; before statement
[ERROR] 1184:11:syntax error
[ERROR] 1185:1:syntax error
[ERROR] 1:0:Compilation produced 6 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 6 syntax errors.
at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:135)
at org.mozilla.javascript.Parser.parse(Parser.java:410)
at org.mozilla.javascript.Parser.parse(Parser.java:355)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:20)
make: \*\*\* [lib/iphone/phonegap-min.js] Error 2
Head to line 1072 of lib/iphone/phonegap.js and add a new line and semi-colon between }Compass, then head to line 1184 and add another new line and semi-colon between }Notification.
You can then go ahead and run the Makefile again.
Ta-da.