Editing User:Jebba

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 21: Line 21:
=Package Building HOWTO=
=Package Building HOWTO=
 +
Here's how to build a "standard" ./configuresque package for Maemo 5, using "foo" as an example. This is a command line application...
-
The [[User:Jebba/Package Building HOWTO|Package Building HOWTO]] now has its own page. :)
+
==Environment==
 +
First set up your initial environment in the scratchbox to save future keystrokes. This only has to be set up once.
 +
 
 +
# log in to development/SDK server:
 +
ssh -C flauta.freemoe.org
 +
 +
# Enter scratchbox
 +
/scratchbox/login
 +
 +
# Set up your full name for debianization (enter your name, not mine!):
 +
echo 'export DEBFULLNAME="Jeff Moe"' >> ~/.bashrc
 +
 +
# Set up email address for debianization (enter your email, not mine!):
 +
  echo 'export DEBEMAIL="moe@blagblagblag.org"' >> ~/.bashrc
 +
 +
# Re-read bashrc to drag in above:
 +
. ~/.bashrc
 +
 
 +
# Check that all looks cool:
 +
echo $DEBEMAIL ; echo $DEBFULLNAME
 +
 
 +
==Package Setup==
 +
Now do the actual creation of the package:
 +
 
 +
# Set up some dirs for workingspace:
 +
mkdir -p ~/foo/freemoe
 +
 +
# go there
 +
cd ~/foo/freemoe
 +
 +
# grab source from upstream
 +
wget http://foo.googlecode.com/files/foo-1.2.3.tar.bz2
 +
 +
# Untar the source
 +
tar jxf foo-1.2.3.tar.bz2
 +
 +
# Upstream doesn't have .gz in this case, \
 +
# so re-tar because the version of debhelper in Maemo 5 doesn't support .bz2 (!)
 +
tar zcf foo-1.2.3.tar.gz foo-1.2.3
 +
 +
# Enter source dir
 +
cd foo-1.2.3
 +
 +
# Check WTF the LICENSE is
 +
less COPYING
 +
 +
# Initial setup of package
 +
dh_make --single \
 +
  --copyright gpl \
 +
  --file ../foo-1.2.3.tar.gz
 +
 +
# Set up for maemo-optification:
 +
echo auto > debian/optify
 +
 
 +
==debian/control==
 +
debian/control defines info about the package that is read in such places as the application installer.
 +
 
 +
* In the Description:, lines MUST be preceded by a space. Blank lines must have a space and then a period.
 +
 
 +
* Check this to find a [[Documentation/Maemo_5_Developer_Guide/Packaging%2C_Deploying_and_Distributing#Sections|valid Section:]]
 +
 
 +
* Figuring out Build-Depends: is currently left as an exercise for the reader. Hints:
 +
fakeroot apt-get update
 +
fakeroot apt-cache search bar
 +
fakeroot apt-get install bar
 +
 
 +
Here is a sample debian/control:
 +
 
 +
Source: foo
 +
Section: user/multimedia
 +
Priority: extra
 +
Maintainer: Jeff Moe <moe@blagblagblag.org>
 +
Build-Depends: debhelper (>= 5), autotools-dev, maemo-optify
 +
Standards-Version: 3.7.2
 +
 +
Package: foo
 +
Architecture: any
 +
Depends: ${shlibs:Depends}, ${misc:Depends}
 +
Description: Foo does everything you want.
 +
  Foo does everything. It is fantastic.
 +
  .
 +
  Be sure to explore all of Foo, especially the clone x-fade tool.
 +
  .
 +
  There is so much to Foo!
 +
 
 +
==debian/changelog==
 +
Edit changelog:
 +
dch -i
 +
 
 +
Edit debian/changelog to read:
 +
foo (1.2.3-1) unstable; urgency=low
 +
 +
  * Initial release for Maemo 5 (Nokia N900).
 +
 +
-- Jeff Moe <moe@blagblagblag.org>  Tue, 22 Dec 2009 17:00:02 -0300
 +
 
 +
==Build Binary X86 Package==
 +
Now you're ready to actually build the package. This may help you find out what the Build-Depends: are as well.
 +
 
 +
===X86===
 +
Now see if it works in x86:
 +
 
 +
# Switch to X86
 +
sb-conf select FREMANTLE_X86
 +
 +
# Go to the correct dir:
 +
cd ~/foo/freemoe/foo-1.2.3
 +
 +
# Compile!
 +
dpkg-buildpackage -rfakeroot -b -uc
 +
 
 +
 
 +
===Optify .deb===
 +
If that all went cool, "optify" the package (am I doing this right?--I was doing it differently before, but this was recommended by upstream and is how the Maemo builder box does it):
 +
 
 +
# Go to correct dir
 +
cd ~/foo/freemoe
 +
 
 +
# Optify X86 package:
 +
maemo-optify-deb foo_1.2.3-1_i386.deb
 +
 +
# Optify non-binary package (if any):
 +
maemo-optify-deb foo_1.2.3-1_all.deb
 +
 +
# Or if you have a bunch of packages and you're lazy, just
 +
for i in *.deb
 +
  do echo $i
 +
  maemo-optify-deb $i
 +
done
 +
 +
# Check optification results:
 +
dpkg -c foo_1.2.3-1_i386.deb
 +
 
 +
==Test in scratchbox==
 +
You can test your package in the scratchbox:
 +
 
 +
# Install in scratchbox
 +
fakeroot dpkg -i foo_1.2.3-1_i386.deb
 +
 +
# Run it!
 +
foo
 +
 
 +
==Build Binary ARMEL Package==
 +
Now you're ready to actually build the package that will run on the phone.
 +
 
 +
===ARMEL===
 +
# Switch to ARMEL
 +
sb-conf select FREMANTLE_ARMEL
 +
 +
# Go to the correct dir:
 +
cd ~/foo/freemoe/foo-1.2.3
 +
 +
# Compile!
 +
dpkg-buildpackage -rfakeroot -b -uc
 +
 
 +
 
 +
===Optify .deb===
 +
If that all went cool, "optify" the package (am I doing this right?--I was doing it differently before, but this was recommended by upstream and is how the Maemo builder box does it):
 +
 
 +
# Go to correct dir
 +
cd ~/foo/freemoe
 +
 +
# Optify ARMEL package:
 +
maemo-optify-deb foo_1.2.3-1_armel.deb
 +
 
 +
# Optify non-binary package (if any):
 +
maemo-optify-deb foo_1.2.3-1_all.deb
 +
 +
# Or if you have a bunch of packages and you're lazy, just
 +
for i in *.deb
 +
  do echo $i
 +
  maemo-optify-deb $i
 +
done
 +
 +
# Check optification results:
 +
dpkg -c foo_1.2.3-1_armel.deb
 +
 
 +
 
 +
==Build Source Package==
 +
Build a source package for uploading to builder (I'm not 100% this is the optimal command, but worksforme).
 +
 
 +
# cd to dir
 +
cd ~/foo/freemoe/foo-1.2.3
 +
dpkg-buildpackage -rfakeroot -S -uc -us -sa
 +
 
 +
==Put Package in Personal Repository==
 +
Now that it's all built and cool, copy the file over to your N900. I put it in my own repo and install it with apt on my N900. You don't have to set up a repo to do all this, but it's nice
 +
 
 +
# Exit from scratchbox
 +
logout
 +
 +
# Create source dir on web server:
 +
mkdir -p /var/www/users/jebba/dists/unstable/main/source/foo_1.2.3-1
 +
 +
# Create binary dirs on web server:
 +
mkdir -p /var/www/users/jebba/dists/unstable/main/binary-armel
 +
mkdir -p /var/www/users/jebba/dists/unstable/main/binary-i386
 +
 +
# Copy over orig tarball:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*.diff.orig.tar.gz \
 +
/var/www/users/jebba/dists/unstable/main/source/foo_1.2.3-1/
 +
 +
# Copy over diff:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*.diff.gz \
 +
/var/www/users/jebba/dists/unstable/main/source/foo_1.2.3-1/
 +
 +
# Copy over dsc:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*.dsc \
 +
/var/www/users/jebba/dists/unstable/main/source/foo_1.2.3-1/
 +
 +
# Copy over changes:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*.changes \
 +
/var/www/users/jebba/dists/unstable/main/source/foo_1.2.3-1/
 +
 +
# Copy over ARMEL binary:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*_armel.deb \
 +
/var/www/users/jebba/dists/unstable/main/binary-armel/
 +
 +
# Copy over X86 binary:
 +
cp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*_i386.deb \
 +
/var/www/users/jebba/dists/unstable/main/binary-i386/
 +
 +
# Regenerate repository headers:
 +
cd /var/www/users/jebba/
 +
 +
# Binary ARMEL Packages
 +
dpkg-scanpackages dists/unstable/main/binary-armel /dev/null \
 +
| gzip -9c > dists/unstable/main/binary-armel/Packages.gz
 +
 +
# Binary X86 Packages
 +
dpkg-scanpackages dists/unstable/main/binary-i386 /dev/null \
 +
| gzip -9c > dists/unstable/main/binary-i386/Packages.gz
 +
 +
# Source Packages
 +
dpkg-scansources dists/unstable/main/source /dev/null \
 +
| gzip -9c > dists/unstable/main/source/Sources.gz
 +
 
 +
==Install Package==
 +
Install the sucker.
 +
 
 +
===Testing via manual copying===
 +
If you don't have your own personal repository, do something like this, where 10.0.0.2 is the IP address of your N900:
 +
 
 +
# copy file to N900
 +
scp -p /scratchbox/users/jebba/home/jebba/foo/freemoe/*_armel.deb \
 +
10.0.0.2:MyDocs/
 +
 +
# ssh into N900
 +
ssh user@10.0.0.2
 +
 +
# Install .deb
 +
sudo gainroot
 +
dpkg -i /home/user/MyDocs/foo_1.2.3-1_armel.deb
 +
 
 +
===Testing via personal repo===
 +
If you have your own repo, enable it, ala:
 +
 
 +
# edit sources to enable personal repo:
 +
sudo gainroot
 +
vim /etc/apt/sources.list
 +
 +
# In my case, I add the line:
 +
deb http://www.freemoe.org/users/jebba unstable main
 +
 +
# Update repo
 +
apt-get update -o dir::cache=/home/user/MyDocs/.apt-archive-cache
 +
 +
# Install package
 +
apt-get install -o dir::cache=/home/user/MyDocs/.apt-archive-cache foo
 +
 
 +
==Test Package==
 +
Now time to actually test it. Just run it :)
 +
 
 +
foo
 +
 
 +
Also helpful commands, like:
 +
dpkg -I foo
 +
dpkg -l foo
 +
dpkg -l | grep foo
 +
dpkg -L foo
 +
 
 +
==Upload to Builder==
 +
If your package works well, time to upload to Maemo's builder to put it in extras-devel. Note, you'll need to have set up an ssh key on garage to do this.
 +
 
 +
# go to the dir, from outside the scratchbox
 +
# (if your ~/.ssh key isn't in the scratchbox)
 +
cd /scratchbox/users/jebba/home/jebba/foo/freemoe
 +
 +
Uh, just run this script:
 +
 
 +
#!/bin/sh
 +
 +
echo
 +
echo "Uploading:"
 +
ls *.tar.gz *.diff.gz *.changes *.dsc
 +
echo
 +
 +
echo -n "All look ok? ctrl-c to quit " ; read ok
 +
echo
 +
 +
scp -p *.tar.gz *.diff.gz *.changes *.dsc \
 +
jebba@garage.maemo.org:/var/www/extras-devel/incoming-builder/fremantle/
 +
 
 +
==Chill==
 +
Now just wait for the package to finish. You can repeatedly hit <reload> in your browser, or ctrl-5 here:
 +
 
 +
* [https://garage.maemo.org/builder/fremantle/?C=M;O=D Builder directory]
 +
 
 +
* [https://garage.maemo.org/extras-assistant/index.php Package queue]
 +
 
 +
* [http://maemo.org/packages Packages (search)]
=Kernel=
=Kernel=

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)