Mikrokopter DUBwise compilation

 baris
 5 Ekim 2010

Birkaç gündür Mikrokopter için cep telefonu ile kumanda edebilme yeteneği olan DUBwise isimli bir yazılımı derlemeye çalışıyorum. Oldukça uğraştırdığını itiraf etmeliyim ama sonunda galip gelen ben oldum. Yaşadığım sıkıntıları başkaları da yaşamasın diye dökümante etmeye karar verdim. Zaten kodu yazan Mr. Ligi ile de iletişime geçtiğimde o da sıkıntıların olduğunu ama bir türlü bir doküman hazırlayamadığını söylemişti.

Hazırlayıp kendisine de gönderdiği dokümanı buradan da yayınlamak ,istedim, belki birilerinin işine yarar. Doküman ingilizce ama adım adım anlatım olduğu için herkes tarafından kolay anlaşılacağını düşünüyorum. googletranslate yeterli olmaz ise sorularınızı bana yazabilirisiniz, elimden geldiğince yardımcı olmaya çalışırım.

This document is prepared to guide you through a successful compilation of dubwise and preparing a development environment for it.

These are the prerequisites (the versions are the ones I used for compilation, maybe prior or later versions may work as well)

– Linux OS (Ubuntu 10.04)
– Sun Java SDK (jdk1.6.0_21 downloaded from sun.java.com and installed under /opt/jdk1.6.0_21, alternatives modified accordingly, please check that you are using this java with the ‘java -version’ command)
– Wireless ToolKit 2.5.2 installed in directory /opt/WTK2.5.2
– git (if you want to download from git repository you’ll need git. Install git using the command ‘apt-get install git’. If you don’t want to use repository, you can download the sources from the web pag eas well)
– ruby 1.8.7 (installed with the command ‘apt-get install ruby’)
– rubygems 1.8 (installed with the command ‘apt-get install rubygems’)
– rio gems package (installed with the command ‘gem install rio’)
– 7zip or advzip (use the commands ‘apt-get install advancecomp’ and ‘apt-get install p7zip-full’)
– Download tracedroid.jar from http://github.com/ligi/tracedroid and put it somewhere in your classpath (e.g. : MK/DUBwise/j2me/libs)
– You need to set environment variable RUBYOPT to be comfortable with gems (use this commad ‘export RUBYOPT=rubygems’ or put it into your profile/bashrc)

Prepare the compilation environment as follows:

1) Create a working directory (e.g. : MK)

Open a shell/terminal and type :
$ mkdir MK
$ cd MK

2) Download the DUBwise source
2.1) Alternative 1 : Download the DUBwise source from git repository (links might change in time, please check ligi’s blog)

$ git clone http://github.com/ligi/DUBwise.git
OR
$ git clone git://github.com/ligi/DUBwise.git

This command will downlload the source into a directory called DUBwise on our computer into the current folder.

The output will be something like this :
—————————————-
Initialized empty Git repository in /home/baris/MK/DUBwise/.git/
remote: Counting objects: 3728, done.
remote: Compressing objects: 100% (1338/1338), done.
remote: Total 3728 (delta 1550), reused 3348 (delta 1374)
Receiving objects: 100% (3728/3728), 10.97 MiB | 251 KiB/s, done.
Resolving deltas: 100% (1550/1550), done.

2.2) Alternative 2 : Download the DUBwise source from web page (links might change in time, please check ligi’s blog)

Go to web page ‘http://github.com/ligi/DUBwise/downloads’ using your favorite browser and download the source code package. Extrack it to the directory you created (MK in our case). Be sure that the resulting directory structure is as follows, if not, correct it accordingly:
-MK
+—DUBwise
+—–android
+—–j2me
+—–shared

3) cd into j2me directory
$cd DUBwise/j2me/

4) Modify build.xml using your favorite editor, ad change the property wtk.home to point the directory of your WTK installation (/opt/WTK2.5.2 in our case)

5) Generate the MKParamsGeneratedDefinitions.java file (this is a workaround I found, this should be in the ruby BUILD script as well, maybe ligi prepares a patch for it)
$ cd ../shared/misc/pc-komp-ref
$ ruby generate.rb

The command will last for a while and will result with this line :
written ../../../android/shared_src/org/ligi/ufo/MKParamsGeneratedDefinitions.java

go back to j2me directory
$ cd ../../../j2me

6) Correct the BUILD file for 7zip/advzip parameter errors. I hope ligi will correct this script soon, otherwise 7z/advzip commands in the BUILD script fail and can’t add them images/sounds to the jar file.

Open the file called BUILD with your favorite editor and change these lines : (we need the argument ‘-tzip’ to tell 7z/advzip that the filetype is jar)

line 451:
log `cd res/images_by_screensize/#{@screensize} ; 7z a -tzip -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * ; cd ../../.. ` #  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`

line 455:
log `cd res/firmwares/#{@firmware} && 7z a   -tzip -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * && cd -`

line 458:
log `cd res/voice_samples_by_name/#{@voice_mode} ; 7z a  -tzip -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * ; cd ../../..`

7) Now we are ready to compile our DUBwise

You can compile for all platforms (N80, K800, K800i, etc, and all screen sizes with sound, no_sound, etc.) using the command

$ ruby BUILD all

If you prefer to compile for a single platform (in my case K800i) you can use the command

$ ruby BUILD K800i

Ignore these errors:
– “[taskdef] Could not load definitions from resource antenna.properties. It could not be found.” This is because there are two definitions for antenna.properties in build xml. You don’t need to fix it, but if you want to, delete this line from build.xml

– “mkdir: cannot create directory `bin’: File exists”. It is because I did a previous compilation and I already have an output directory. You can get rid of it by deleting the bin directory before a compilation 🙂

– “cd: 1: can’t cd to res/firmwares/no_firmwares” this is because I don;t have firmware binaries in my environment

The command will result with lines similar to these ones:

done build # 1/1(newbuilds:1 Time:5.004662 overall: 0:6
“voice_modeen_mp3_32kbit”
“Screensize 240×320”
“size363730”
“—————”
Joining all open threads (0open)/home/baris/MK/DUBwise/j2me
`build.props.bak’ -> `build.props’
Finished in 0:10

8) Now you are done, and ready to test it. Uze the emulator provided by the WTK as follows:

(please change the jad filename according to your compilation)

$ /opt/WTK2.5.2/bin/emulator -Xdescriptor:./bin/DUBwise-v0.80a-240×320-en_mp3_32kbit-no_firmwares-CLDC11-BluetoothAPI-DeviceControl.jad

9) Enjoy it…. I will try to put a document together for an Eclipse development environment, Netbeans maybe 🙂

Please feel free to contact if you have questions…. Baris DINC ( namesurname at gmail)

 

Yazı hakkında görüşlerinizi belirtmek istermisiniz?