Writing Tizen Build Spec

From Tizen Wiki
Jump to: navigation, search


Tizen platform packages are packaged by RPM. Essentially, Tizen uses rpmbuild as well.

Each package must have an RPM .spec file in /packaging/ directory in order to allow Tizen build systems (OBS/GBS) to recognize how to build the pacakge. In general, you are not allowed to have multiple .spec files and you need a special permission from Release Enginners to have multiple .spec files working.

When a build attempt is requested for Tizen build systems (OBS/GBS), the build system will create a new fresh "virtual" system that has the minimal required packages installed in the "virtual" system so that regardless of which system you are using, the build system can guarantee that the resulting binary package (.rpm file) is identical to your colleagues as long as you share the same "Tizen build options". You may assume that you'll get a virtual desktop that is formatted and reinstalled of the whole OS for each build attempt.

Scheme of RPM build description, .spec file

#Package meta information (name, version, summary, description, dependencies, and so on)
Name: basic
Summary: basic example RPM
Version: 1.0.0
Release: 1
License: Apache-2.0
Basic Package is The Example

#Description on how to build this package

# How to prepare to build.
%setup -q # The standard RPM macro to unpack codes at build directory.


# How to build (make/compile/...)
%cmake .

# RPM macro to execute cmake with some environmental arguments (e.g., libdir, includedir, ...)


# How to install (which files to be installed to the system)

# RPM macro to execute make install with some environmental arguments (e.g., bindir, libdir, ...)
# You may cp other files to %{buildroot}%{_bindir}, %{buildroot}%{_libdir}, or whatever appropriate in %{buildroot}
#Description on the shape of the final produect, the RPM file.


# The list of files included in the RPM. The files installed at %install with %{buildroot} path-prefix are described here.
# If there are missing files (installed at %install, but omitted in %files sections), it will generate build errors.




# scripts to be executed at rpm-install/upgrade after files in %files are copied to the system
echo "Hello World"

cp /etc/conf.ini /tmp/trash



# scripts to be executed at rpm-install/upgrade before files in %files are copied to the system
echo "Going to say hello world soon"

%postun -p /sbin/ldconfig

# -p option indicates that there will be a single line for the script (no need to invoke a shell)
# preun scripts are executed after uninstalling the package.

Note that this is a simplified basic description on the RPM spec file syntax.

Please refer to RPM.org or other Linux RPM related documents for more detail because Tizen is not adding any additional syntax to RPM.

Inter-package Relations

The following dependencies are widely used in Tizen platform codes:

  • BuildRequires (applies globally to the whole spec file because the whole spec file is built at a single build attempt)
  • Requires
  • Provides
  • Conflicts

The following weak dependency is widely used in Tizen >= 4.0 to support multiple profiles in a single repository, resolving build-time dependency ambiguity

The following very weak dependency is widely used in Tizen >= 4.0 to provide user-understandable UI at Tizen Image Configurator

  • Suggests
    • In TIC metapackages (a.k.a. blocks), Suggests shows "optional" elements and Requires shows "mandatory" elements.

The following dependency is sometimes used in Tizen >= 4.0 to provide replacements in some devices

  • Obsoletes

Case Study

Caution / Tips

  1. Tizen version check mechanism
  2. RPM Upgrade vs Uninstall (writing preun/postun scripts)
  3. Backward compatibility with Tizen < 4 / GBM
  4. No "profile" macro in spec files
    • Exception:
  5. No "_repository" macro in spec files
  6. No "tizen_target_name" macro in spec files
  7. Other macros that requires caution
    • tizen_profile_name