24. Native Packages

## 24. Native Packages

### 24.1. Generation of Native Packages

The Professional and Enterprise versions of InstallBuilder support generation of native packages. To generate the packages, the appropriate command line tools must be present in the Linux system used at build-time, such as rpm or dpkg. The target platform needs to be specified as rpm or deb in the command line environment or can be selected in the build screen using the GUI builder.

### 24.2. Integration with Native Package Systems

BitRock InstallBuilder allows you to register the software being installed with the RPM or DEB package databases.

To enable RPM and DEB registration support add `<registerWithPackageDatabase>1</registerWithPackageDatabase>` to your installer project file. This will register your installation with the RPM and DEB database. From this point on, users will be able to query data about your application and its installed files using your distribution’s rpm-based tools as with any other existing rpm package. You will also be able to uninstall the application using your distribution’s rpm-based tools.

RPM database integration requires installation as root in an RPM-based distribution. Otherwise, the setting will be ignored. Also, if the RPM generation is performed on a 64bit machine, then 64bit RPM packages will be generated instead of 32bit ones.

To generate the packages, the appropriate command line tools need to be present in the Linux system used at build-time, such as `rpm` or `dpkg`. The target platform will be specified as `rpm` and `deb` in the command line environment or can be selected in the build screen using the GUI builder.

Additionally, to successfully register an RPM, the following tags must be also present in the XML project file:

RPM information tags.

      <project>
        ...
        <vendor>Your Company Name</vendor>
        <summary>Detailed description of your software</summary>
        <release>0</release>
        <description>A one-line description of your software</description>
        ...
      </project>

The name of the RPM package registered will be `${project.shortName}-${project.version}-${project.release}`

#### Creating custom spec files for RPM installers

RPM packages use a spec file to describe a package. When creating an RPM package, InstallBuilder creates it using built-in templates by default.

InstallBuilder allows creating RPM packages that use a custom spec file. This is useful when an RPM package has to specify dependencies or other fields in the spec file.

If you need to create your own spec file, simply enable the `<rpmSpecFileTemplate>` option in your project:

    <project>
        <rpmSpecFileTemplate>path/to/package.spec</rpmSpecFileTemplate>
        ...
    </project>

Where `path/to/package.spec` should point to a spec file.

A template for a default spec file is as follows:

    %define _unpackaged_files_terminate_build 0
    %define installdir /
    %define _topdir ${bitrock_rpm_topdir}
    %define _rpmdir %{_topdir}
    BuildRoot: ${bitrock_rpm_buildroot}
    Name: ${bitrock_rpm_name}
    Version: ${bitrock_rpm_version}
    Release: ${bitrock_rpm_release}
    Group: ${bitrock_rpm_group}
    Vendor: ${bitrock_rpm_vendor}
    Summary: ${bitrock_rpm_summary}
    License: ${bitrock_rpm_copyright}
    Provides: ${bitrock_rpm_name}
    %description
    ${bitrock_rpm_description}
    %post
    ${bitrock_rpm_post}
    %preun
    ${bitrock_rpm_preun}
    %postun
    ${bitrock_rpm_postun}
    %files
    %defattr(-,root,root)
    ${bitrock_rpm_files}

The `${bitrock_*}` variables are substituted when building the installer.

More information regarding creating and contents of the spec file can be found on RPM.org:

http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html

23. AutoUpdate Tool |  | 25. Builder