Tizen: Building a Platform Application for Emulator
While I am still in love with Tizen platform, and having spent some time fixing build bugs I should not have introduced in the first place, here are my findings about Tizen build system.
Tizen supports both HTML5-based applications and native ones. The latter can be packaged as RPM archives for platform applications or as a widget ZIP archive when installed by a user. RPMs are built using GIT Build System (GBS) which manages a local build chroots, export the sources for building, submit changes to Gerrit etc.
You should install GBS by following the Installing Development Tools guide.
Also note that you don't really need to have all the platform sources on your
local machine as GBS will fetch all the required dependency archives and
re-create the build environment in the chroot. RPM files must specify the
BuildDepends
for the magic to happen.
Emulator builds are different from the real device ones in some subtle ways.
I've spent a few days figuring out why libewebkit2
compiled from the sources
would not work on an emulator. It turned out there exist a separate tizen
repository for emulator RPMs and trying to put real-world packages into an
emulator may fail in really bizzare ways (how do you like a black screen upon
HTML5 app launch?). At the moment of writing the latest snapshot is
tizen-2.2-emul_20130719.2.
You will need a .gbs.conf
in your $HOME. We are building for an emulator,
please note the repo URL:
[general] tmpdir=/var/tmp/ profile = profile.tizen2.2_emul [repo.tizen2.2_emul] url = http://download.tizen.org/releases/2.2-emul/tizen-2.2-emul_20130719.2/ [profile.tizen2.2_emul] repos=repo.tizen2.2_emul
Now we need our application. The source is available from GitHub branch at tizen-example-platform-app.
GBS looks for a packaging
directory for a spec file, so this should be always present:
Name: example-platform-app Version: 1.0 Release: 1 Summary: Example Tizen Platform App License: GPL2 URL: http://rtg.in.ua Source0: %{name}-%{version}.tar.gz %description Example Tizen Platform Application %prep %setup -q %build make %{?_smp_mflags} %install make install DESTDIR=%{buildroot} PREFIX=%{_prefix} %files %{_bindir}/example-platform-app %changelog * Sat Aug 17 2013 Roman Yepishev <roman.yepishev@yandex.ua> - Initial version
Upon cloning the repository you are ready to build the application.
$ git clone https://github.com/roman-yepishev/tizen-example-platform-app.git $ cd tizen-example-platform-app $ gbs build -A i586 info: generate repositories ... ... info: generated RPM packages can be found from local repo: /home/rye/GBS-ROOT/local/repos/tizen2.2_emul/i586/RPMS
GBS automatically creates GBS-ROOT in your home directory, visiting the RPMS shows we have new shiny RPM packages:
$ cd /home/rye/GBS-ROOT/local/repos/tizen2.2_emul/i586/RPMS $ ls example-platform-app-1.0-1.i586.rpm example-platform-app-debuginfo-1.0-1.i586.rpm example-platform-app-debugsource-1.0-1.i586.rpm
While you are at it, there are a few useful gbs build
options,
the full list of options can be seen by running gbs build --help
:
--debug debug output --overwrite overwrite existing binaries and build them anyway -C, --clean delete old build root before initialization --clean-repos clean up local repos created by gbs
Fire up the emulator instance and wait until sdb sees it:
The only part left is to push the RPMs and install them:
$ sdb push example-platform-app-1.0-1.i586.rpm /tmp 1 file(s) pushed. 0 file(s) skipped. example-platform-app-1.0-1.i586.rpm 36 KB/s (4645 bytes in 0.125s) $ sdb root on Switched to 'root' account mode $ sdb shell sh-4.1# rpm -Uhv /tmp/example-platform-app-1.0-1.i586.rpm reading device security policy from /etc/device-sec-policy package ac-domain-system defined ac domain Isolated ... Preparing... ########################################### [100%] no RSA signature, cannot search sw source using _default_ sw source No manifest in this package. Creating default one adding example-platform-app manifest data to system, package_name example-platform-app sw source _default_ provided package example-platform-app Request for a domain name _ is allowed based on package sw source 1:example-platform-app setting SMACK64 _ for /usr/bin/example-platform-app setting SMACK64EXEC _ for /usr/bin/example-platform-app ########################################### [100%] sh-4.1# example-platform-app Hello, Tizen!
Congratulations, you have a platform application running on the emulator. This application does not do anything interesting for now but it can be used as a starting point.
I can also confess that I really like RPMs now.