In the MeeGo handset 1.1 Development Environment [4] [5], we use the QtCreator tool to generate an rpm package. Let's look at the linux rpm package. For a software package, there are two rpm packages, one is *. rpm, one is *. src. rpm, we should package the source program, which will be much better in code management. In addition, it may be a habit. If you can separate QtCreator and compile and package it directly in the linux Command Line, I think it is more convenient and free. This time, we will record how to pack the program into *. src. rpm and *. rpm packages in the command line.
We have discussed this issue in moblin before. In the MeeGo Handset SDK 1.1 environment, we are doing this once by using rpmbuild. We still use the default directory of rpmbuild ~ /Rpmbuild. The following are related steps.
Step 1: create a small project example to be packaged
Using mad to create our project, we can now see which types of projects can be created by mad, and then select create as needed.
$ Mad pscreate-l
TEMPLATE NAME TYPE DESCRIPTION
Lib-simple lib Simple example for C/C ++ library
Python Simple example for Python (Qt) application
Qt-empty prog Empty project for Qt application
Qt-Lib-simple lib simple example for Qt Library
Qt-simple qtprog simple example for Qt Application
Simple prog simple example for C/C ++ Application
$ Mad-t meego-handset-ia32-1.1 pscreate-t qt-simple test-rpm-0.0.1
Note the name of this project. We also add the version information, which is also the standard method for naming RPM packages. Later we will also see the default folder name in the spec file, providing version information, which can help us better manage different versions, of course, the source code, and facilitate patch.
$ CD test-rpm-0.0.1/
$ Mad-t meego-handset-ia32-1.1 qmake
In this step, you can generate makefile and open the MAKEFILE file. We will make some minor modifications to change the absolute path to the relative path, for example, if the absolute path of this folder is in/workspace/meego/test/QT/test-rpm-0.0.1, We can query this path or query install, the absolute path is written when the desktop file is installed in the target. Because we will use the default directory of rpmbuild, and the installation paths are absolutely different in different environments, we need to modify it.
This is where we can directly compile using the make command. Because the experiment is packaged, I only changed the icon description name in the *. desktop file, and changed the hello and world in the source file to other words.
Step 2: Package
When we make sure that there is no problem with compilation, including after debugging on target, we are prepared to encapsulate the released rpm and SRC. rpm. Use make clean to clear all compiled content, and pack test-rpm-0.0.1/into test-rpm-0.0.1.tar.gz. Then we compile the RPM spec file, which can be directly modified using other spec Files written by qtcreator. For details about the spec file, refer:
- Http://wiki.meego.com/Packaging/Guidelines
- Moblin: kernel compilation and rpm packaging (2): RPM Packaging
Below is the contents of the spec file test-rpm.spec for this example
$ Cat test-rpm.spec
# No post install
# % Define _ OS _install_post % {nil}
# No strip
# % Define _ strip/bin/true
# No debug package
# % Define debug_package % {nil}
# Disable automatic dependency processing
# AutoReqProv: no
Name: test-rpm
Version: 0.0.1
Release: 1
License: GPL
Summary: Wei: Test for Meego handset 1.1 *. src. rpm and *. rpm
# Url: <insert url tag>
GROUP: QT/Qt mobility
Source0: Too Many name‑‑0000version‑.tar.gz
# BuildRequires: pkgconfig (QtCore)
# BuildRequires: libqt-devel
% Description
Wei test for Meego handset sdks 1.1 for package *. src. rpm and *. rpm.
% Prep
% Setup-q
% Build
# Add here commands to configure the package.
# % Qmake
# Qmake-makefile-nocache QMAKE_STRIP =: PREFIX =%{_ prefix}
# Add here commands to compile the package.
# Make % {? Jobs:-j % jobs}
# Make % {? _ Smp_mflags}
Make
% Install
# Add here commands to install the package.
# % Qmake_install
Make install INSTALL_ROOT = % {buildroot}
% Files
% Defattr (-, root, root ,-)
% {_ Prefix }/*
We will proceed in the standard directory of rmpbuild, you can directly execute rpmbuild-Ba test-rpm.spec, run will report an error, but will generate the correct default path ~ /Rpmbuild, under this directory there will be the following directory build/buildroot/RPMS/sources/specs/srpms/, we copy the test-initrpm.0.0.1.tar.gz file to the sources directory, copy the test-rpm.spec file to specs, go ~ /Rpmbuild/specs directory, execute the command rpmbuild
-Ba test-rpm.spec, the source file will be stored in the build/path after decompression, the extracted files on the target machine will be under buildroot, the test-rpm-0.0.1-1.i386.rpm will be stored in the RPMS/i386/path, and the source file RPM package test-rpm-0.0.1-1.src.rpm is located in srpms /.
Step 3: Test
We open the simulator or target machine and pass the RPM over the network.
$ SCP-P 6666/home/Wei/rpmbuild/RPMS/i386/test-rpm-0.0.1-1.i386.rpm meego @ localhost:/home/meego
The source file RPM package is used for archiving and saving. we will delete it ~ /Rpmbuild, and then run rpm-ivh xxxx. SRC. rpm on the local machine ~ /Rpmbuild source code recovery. We log on to the simulator via SSH, and install the rpm-IVH test-rpm-0.0.1-1.i386.rpm as sudo under/home/meego, and delete the rpm-E test-rpm. After the installation, we can see the figure on the left of the desktop as shown in the figure below, and click the picture, as shown in the right figure:
Related Links: My MeeGo/Moblin articles