Distribute your XULRunner app - 2.3 - Special case, deb for Maemo
Par joliclic le lundi, mai 23 2011, 12:47 - mozilla - Lien permanent
Ce billet existe aussi en français
This post is part of a series about how to package a XULRunner application.
See the preamble for the context case.
2.3 Special case : deb for Maemo
- 2.3.1 Maemo generalities
- 2.3.2 Adapt the launcher
- 2.3.3 A new file system organization - Where place our app
- 2.3.4 Additions to the
.desktop
file - 2.3.5 Changes to the Debian files
- 2.3.6 Create the deb
2.3.1 Maemo generalities
Maemo is a Linux, Debian based, distribution, for Mobile. And Firefox
Mobile, aka Fennec, is available on this platform.
Fennec, like the desktop version of Firefox, is able to
launch a XULRunner application via the -app
argument.
So, a priori, we can launch any XULRunner applications. Of course, we should care of the specificities of mobile devices, small screen (but with high resolution), and touch screen. That's not the purpose of this howto. But as is, our app should work.
Because this platform is Debian based, we will distribute our app with a deb. We have just to adapt some parts of the previous chapter to the specificities of Maemo.
We can find some information in the Maemo Wiki.
2.3.2 Adapt the launcher
The change is that we invoke Fennec rather than Firefox.
The new launcher, myapp.sh
:
#!/bin/sh
CUR_DIR=$(dirname $(readlink -f "$0"))
if [ -x /usr/bin/fennec ]; then
/usr/bin/fennec -app "$CUR_DIR/application.ini" $@
elif [ -x /usr/bin/xulrunner ]; then
/usr/bin/xulrunner "$CUR_DIR/application.ini" $@
else
echo "Error: unable to find Fennec or XULRunner!"
fi
2.3.3 A new file system organization - Where place our app
On Maemo, due to the memory space on mobile devices,
the applications should reside in the folder /opt/
rather than
in /usr/lib/
or /usr/share/
.
So, we will copy our app in /opt/myapp/
.
A sub-directory would possible too,
/opt/myorganization/myapp/
for example.
For the icons, we will use different dimensions than for the desktop,
like Fennec does itself:
a 26x26px png, a 40x40px png, and a 48x48 svg.
Their final locations change a little too, they must be placed in:
- /usr/share/icons/hicolor/26x26/hildon/myapp.png
- /usr/share/icons/hicolor/40x40/hildon/myapp.png
- /usr/share/icons/hicolor/scalable/hildon/myapp.svg
The location of the .desktop
file change too, it must be
placed into /usr/share/applications/hildon/
.
The .desktop
file and the images are not so heavy, we can
put them as is, but it should be possible to place them in our main app
folder and use symbolic links too.
2.3.4 Additions to the .desktop
file
Some information can be found in this page of the Maemo Wiki.
Some additional keys can be used in the desktop file. Not all that I add
are documentated, but they seems to be used by a lot of programs,
perhaps for some older version of Maemo.
Here's some lines added to our desktop file:
X-Icon-Path=/usr/share/icons
X-Window-Icon=myapp
X-Window-Icon-dimmed=myapp
X-Osso-Type=application/x-executable
2.3.5 Changes to the Debian files
To avoid to overwrite the generic deb created in the previous chapter, we will rename this new deb package for Maemo. We will use 'myapp-mobile'. To be consistent with the debhelper process, here the list of all this concerned changes:
-
In the
changelog
file, the linemyapp (1.0-1) unstable; urgency=low
becomesmyapp-mobile (1.0-1) unstable; urgency=low
-
In the
control
file, the value for theSource
andPackage
fields is changed tomyapp-mobile
-
The file
myapp.links
is renamed asmyapp-mobile.links
Other changes to the control
file:
According to
this documentation,
we must choose a Section
in this list:
user/desktop
user/development
user/education
user/games
user/graphics
user/multimedia
user/navigation
user/network
user/office
user/science
user/system
user/utilities
We can add extra data to the control file, used to build the deb.
The first is XB-Maemo-Display-Name: MyApp
.
The second is a base64 icon, used by the application manager of Maemo,
XB-Maemo-Icon-26
.
We will use a bash script to create this base64 value from the 48px png icon.
First we need the uuencode
program, on debian/ubuntu:
apt-get install sharutils
then, we create a Bash script named build_base64.sh
to
convert a 48x48px png into the desired text value:
#!/bin/bash
set -e
# base64 conversion
uuencode -m icon48.png icon48.png > icon48.txt
# remove the first line (begin-base64 ...)
sed -i '1d' icon48.txt
# and the last line (====)
sed -i '$d' icon48.txt
# add 4 spaces at the beginning of each lines
sed -i "s/^/ /" icon48.txt
# and add a blank line at the end of the file
echo '' >> icon48.txt
You can find this script into the data/icons
folder of the
samples_chapter_2.tar.gz
archive. To launch it (into the
icons folder):
sh build_base64.sh
We can now use the content of icon48.txt as the value of
XB-Maemo-Icon-26
in our control file.
2.3.6 Build the deb
And, that's all, we can create our deb like in the previous chapter.
I don't write here the build_maemodeb.sh
script, it's
almost the same as the one to build the generic debian package. You'll
find it in the joined archive.
cd samples_chapter_2
sh ./build_maemodeb.sh
Note: I suppose in this howto that we don't have compiled code in our app.
If this is not the case, we must use
scratchbox
to compile, and we
must use scratchbox to build the deb too!
And, like in the
previous chapter, don't use the line Architecture: all
in the
control file.
You can download all the samples of this chapter 2 (Linux) in the samples_chapter_2.tar.gz archive.
The myapp application, from developer.mozilla.org is in the Public Domain.
The icon used is from the Tango Desktop Project, and is in the Public Domain.
All added data, and sample files, of this chapter 2, are in the Public Domain too.
Commentaires
Hello there! I know this is somewhat off topic but I was wondering which blog
platform are you using for this site? I'm getting sick and tired of Wordpress because I've had issues with hackers and I'm
looking at alternatives for another platform.
I would be great if you could point me in the direction of a good platform.
I all the time emailed this website post page to all my contacts, for
the reason that if like to read it next my contacts will too.
Its not my first time to visit this site, i am visiting this site dailly and get fastidious data from here daily.
Hey there I am so excited I found your blog, I really found you by error,
while I was looking on Digg for something else, Regardless I am
here now and would just like to say many thanks for a incredible post and a all round exciting blog (I also love the theme/design), I don't have time to read through it all at
the minute but I have book-marked it and also included your RSS feeds,
so when I have time I will be back to read a lot more, Please do keep up the
excellent job.
Hello, this weekend is pleasant in favor of me, because this
point in time i am reading this impressive informative post here at my house.
I'm impressed, I have to admit. Seldom do I encounter a blog that's both
equally educative and amusing, and without a doubt, you've hit the nail on the head.
The problem is something not enough men and
women are speaking intelligently about. I'm very happy I found this in my search for something regarding
this.
Good response in return of this question with solid arguments and telling all regarding that.
Having read this I believed it was very informative.
I appreciate you taking the time and effort to put this information together.
I once again find myself personally spending a lot of time both reading
and posting comments. But so what, it was still worthwhile!
The best form of activity for most people on earth is to practice
their pastimes.
Thanks for sharing.
What's up Dear, are you in fact visiting this web page regularly, if so afterward you will without doubt get nice knowledge.
I’m not that much of a internet reader to be honest butt your blogs really nice, kerep it up!
I'll go ahead and bookmark your site to come back in the future.
All the best
I waas curious if you ever considered changing the page layout off your blog?
Its very well written; I love whazt youve got to say.
But maybe you could a little more in the waay of conteht so people
could connect with it better. Youve got an awful lott of text forr only having one or
twoo images. Maybe youu could space it out better?
Hey there just wamted to give you a quick heads up annd let you know
a few of the images aren't loading properly. I'm not sure why
but I think its a linking issue. I've triued iit in two different web
browsefs and both show the same outcome.
Do you mind iff I quote a few of your posts as long as I provide credit
andd sources back to your blog? My blog site is iin the very same area of interest as
yours and my visitors would truly benefit from some of the information you present here.
Pleasze let me know if this alright with you. Appreciate it!
Hey! I just wanted to ask iif you ever have any trouble
with hackers? My last blog (wordpress) was hacked and I ended up losing months of
hard work duue to no back up. Do you have any solutions
to stop hackers?
What's up, its pleasant post about media print,
we all understand media is a enormous source oof facts.
Hey there just anted to give you a quick heads up and llet
you know a few of the pictures aren't loading properly.
I'm not sure why but I think iits a linking issue. I've
tried it in two different internet browsers annd
both shw the same outcome.
Wow, this paragrapoh is pleasant, my sister iis
analyzing these kinds of things, thus I am going to convey her.
I every time used to study paragraph in news papers but now as I am
a user of net thus from now I am using nett forr articles, thanks to web.
Good replies inn return of this isse with real arguments
aand describing everything about that.
Thanks for another great article. Where else may just anyone get that type of information in such a perfect method of writing?
I havce a presentation next week, and I am on the search for such information.
Do yoou mind if I quote a few of your articles as log as I
provide credit and sources back to your weblog? My website iss in the exact same area of interest as yours andd myy visitors would really
benefit from a lot of the information you provide here.
Please llet me know if this okay with you. Thanks!
I was recommended this web site through my cousin. I'm
no loner certain whether or not this put up is written by waay of him ass no
onne else recognise such detailed about myy difficulty.
You are wonderful! Thanks!
Howdy would you mind letting me know whih hosting company you're utilizing?
I've loaded your blog in 3 completely diffeerent web browsers and I must saay
this blog loads a lot faster tben most. Can you recommend a good hosting provider at a honest price?
Manny thanks, I appreciate it!
I like the valuable information you provide in your articles.
I wil bookmark your weblog and check again here frequently.
I'm quite certain I will learn a lot of new stuff rght here!
Best of luck for the next!
Remarkable issues here. I am very glad to see your post.
Thanks so much and I'm taking a look ahead to contact you. Will you kindly drop me a mail?
My developer is trying to convince me to move to .net from PHP.
I have always disliked the idea because of thee expenses.
But he's tryiong nonee the less. I've been using
Movable-type on numerous websites for about a year and am worried about switching to another platform.
I have heard good things abnout blogengine.net. Is there a way I can transfer
all my wordpress content into it? Any help would be really appreciated!
Goood post. I definitely love this website. Keep it up!
My brother suggested I would possibly llike this web site.
He was totally right. This publish actually made my day.
You can not believe just howw a lot time I had spent foor this information!
Thanks!
Hello Dear, are you genuinely visiting this web site on a regular basis, if so afterward you will without doubt take good knowledge.
Hey ould youu mind stating whixh blog platform you're working with?
I'm looking to start my own blg soon but I'm having a hard time making a decision beteen BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and
style seems different then most blogs and I'm looking for something unique.
P.S Apologies for being off-topic but I had tto ask!
What i don't realize iis in truth how you are no
longer actually much more well-liked than you might be now.
You are so intelligent. You know therefore significantly in relation to ths matter, made me in my view believe it from
numerous vwrious angles. Its liike men and women are not fascinated
unless it is one thing to do with Girl gaga!
Your individual struffs excellent. At all times care for it up!
Today, I went to the beacch with my kids. I found a sea sheell and gave it to my 4
yeqr old daughter andd said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed.
There was a hermit crab inside and it pinched her
ear. She never wants tto go back! LoL I know this iss completely off topic buut I
had to tell someone!
Usuallyy I do nnot learn article on blogs, but I would like to
say that this write-up very compelled me to try and doo it!
Your writing style has been surprised me. Thanks, quite nice
article.
Hey are using Wordpfess for your sitge platform?
I'm new tto the blog world but I'm trying to gett started and create
my own. Do you need any coding expertise to make
your ownn blog? Any help would be really appreciated!