Skip to content

July 26, 2009

vbox-runner on fedora 11

I just built my first RPM for fedora! w000t!

In this post I will document the steps I took to make it build. I’ll start from the very beginning.

Tools used:
yum groupinstall "Development Tools"
yum install rpmdevtools

as stated here.

Then I installed rpmlint because I wanted to check on my .spec file to make sure it was in good condition, usage:
rpmlint -i specfile

Ran rpmbuild-setuptree which will create an “rpmbuild” directory in your $HOME directory. Underneath “rpmbuild” are a set of subdirectories (such as SPECS and BUILD), which you will use for creating your packages. The “rpmdev-setuptree” also creates an “~/.rpmmacros” file which will cause rpm and rpmbuild to use them when appropriate. /quote

Got the source from Kde-Look and put it in ~/rpmbuild/SOURCES, and then cd to ~/rpmbuild/SPECS folder and ran
rpmdev-newspec vbox-runner
This creates the file vboxrunner.spec file, that need to be edited to suit the program. Since I had no idea about how to install a package without a configure and/or make file (this one doesn’t) I grabbed another file from the archlinux user repositories (AUR), because I  have used that one before when I was using Archlinux, had a look at the PKGBUILD for clues of what to fill the spec file with.

This is the PKGBUILD:
Contributor: Jan Zitnik <jan@zitnik.org>
pkgname=vbox-runner
pkgver=0.2
pkgrel=1
arch=(i686 x86_64)
pkgdesc="Run Virtualbox machines in KRunner"
url="http://www.kde-look.org/content/show.php/VBox+Runner?content=107926"
license="GPL"
depends=('kdebase')
makedepends=('cmake' 'gcc' 'automoc4')
source=(http://www.kde-look.org/CONTENT/content-files/107926-vbox-runner-$pkgver.tar.gz)
md5sums=('0c9c34bed0001b17ee882a3764ef047d')

build() {
cd $startdir/src/vbox-runner-$pkgver
mkdir build
cd build

cmake ../ || return 1
make || return 1
make DESTDIR=$startdir/pkg install || return 1

And this is the vbox-runner.spec file before:
Name: test
Version:
Release: 1%{?dist}
Summary:

Group:
License:
URL:
Source0:
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:
Requires:

%description

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc

%changelog
And the completed one, after I scratched my head a while:

Name: vbox-runner
Version: 0.2
Release: 1%{?dist}
Summary: Run Virtualbox machines in KRunner

Group: User Interface/Desktops
License: GPL
URL: http://www.kde-look.org/content/show.php/VBox+Runner?content=107926
Source0: http://www.kde-look.org/CONTENT/content-files/107926-vbox-runner-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: cmake gcc automoc4 kdebase-devel
Requires: kdebase

%description
vbox-runner is a plugin for krunner, virtualbox machines can be started directly from krunner with this plugin.

%prep
%setup -q

%build

%install
rm -rf %{buildroot}
cmake -DCMAKE_INSTALL_PREFIX=/usr
make install DESTDIR=%{buildroot}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc
%{_libdir}/kde4/krunner_vbox.so
%{_datadir}/kde4/services/*.desktop
%{_datadir}/pixmaps/*

%changelog
* Sun Jul 26 2009 Magnus Tuominen magnus.tuominen@gmail.com 0.2-1
- Initial RPM for fedora.

The build will complain about some rpath issue with krunner_vbox.so so it has to be built with these options:
QA_RPATHS=$[0x0001|0x0010 ] rpmbuild -ba vbox-runner.spec
otherwise it will fail with this error message:
ERROR 0001: file '/usr/lib/kde4/krunner_vbox.so' contains a standard rpath '/usr/lib' in [/usr/lib:/usr/lib/kde4/devel]
error: Bad exit status from /var/tmp/rpm-tmp.gL6Psw (%install)

The result is this:

krunner-fedora

Pretty sweet huh?

You can grab the RPMs with the source from here.

http://rubbad.com/files/fedora/11/

Remember, all commands are to be run as user, except for the installation of the tools part, do NOT run these as root, ever!
Many thanks to Konqui and Jan Zitnik, whom without this would never had been built..
That's all folks! Comments and pointers appreciated, this is my first attempt at building RPMs after all, and I'm sure there are some things that could have been done differently?
UPDATE: version 0.2-2 is done, I fixed the issue with rpath and rebuilt the rpm according to the fedora package guidelines.
Added

chrpath --delete %{buildroot}%{_libdir}/kde4/krunner_vbox.so to the %install section in the spec file.
UPDATE2 version 0.2-3: addedd

%doc, %post, %postun and %find_lang to spec file.

UPDATE3 (heh) version 0.2-4 is done, now rpmlint and mock are really happy.
some changes to spec file to make rpmlint and mock happy.

Read more from Linux

Share your thoughts, post a comment.

You must be logged in to post a comment.

Bad Behavior has blocked 20 access attempts in the last 7 days.